]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkimcontextsimple.c
Updated Bulgarian translation by Alexander Shopov <ash@contact.bg>
[~andy/gtk] / gtk / gtkimcontextsimple.c
index 08f74b4bb77314f685dd4cb3f659384b9a165d1b..e6267e514e0259f5bc4bdb7dec81f7472e463245 100644 (file)
@@ -929,8 +929,6 @@ static const guint16 gtk_compose_ignore[] = {
   GDK_ISO_Level3_Shift
 };
 
-static void     gtk_im_context_simple_class_init         (GtkIMContextSimpleClass  *class);
-static void     gtk_im_context_simple_init               (GtkIMContextSimple       *im_context_simple);
 static void     gtk_im_context_simple_finalize           (GObject                  *obj);
 static gboolean gtk_im_context_simple_filter_keypress    (GtkIMContext             *context,
                                                          GdkEventKey              *key);
@@ -940,35 +938,7 @@ static void     gtk_im_context_simple_get_preedit_string (GtkIMContext
                                                          PangoAttrList           **attrs,
                                                          gint                     *cursor_pos);
 
-static GObjectClass *parent_class;
-
-GType
-gtk_im_context_simple_get_type (void)
-{
-  static GType im_context_simple_type = 0;
-
-  if (!im_context_simple_type)
-    {
-      static const GTypeInfo im_context_simple_info =
-      {
-        sizeof (GtkIMContextSimpleClass),
-        (GBaseInitFunc) NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc) gtk_im_context_simple_class_init,
-        NULL,           /* class_finalize */
-        NULL,           /* class_data */
-        sizeof (GtkIMContextSimple),
-        0,              /* n_preallocs */
-        (GInstanceInitFunc) gtk_im_context_simple_init,
-      };
-      
-      im_context_simple_type =
-       g_type_register_static (GTK_TYPE_IM_CONTEXT, I_("GtkIMContextSimple"),
-                               &im_context_simple_info, 0);
-    }
-
-  return im_context_simple_type;
-}
+G_DEFINE_TYPE (GtkIMContextSimple, gtk_im_context_simple, GTK_TYPE_IM_CONTEXT)
 
 static void
 gtk_im_context_simple_class_init (GtkIMContextSimpleClass *class)
@@ -976,8 +946,6 @@ gtk_im_context_simple_class_init (GtkIMContextSimpleClass *class)
   GtkIMContextClass *im_context_class = GTK_IM_CONTEXT_CLASS (class);
   GObjectClass *gobject_class = G_OBJECT_CLASS (class);
 
-  parent_class = g_type_class_peek_parent (class);
-
   im_context_class->filter_keypress = gtk_im_context_simple_filter_keypress;
   im_context_class->reset = gtk_im_context_simple_reset;
   im_context_class->get_preedit_string = gtk_im_context_simple_get_preedit_string;
@@ -1002,7 +970,7 @@ gtk_im_context_simple_finalize (GObject *obj)
       context_simple->tables = NULL;
     }
 
-  parent_class->finalize (obj);
+  G_OBJECT_CLASS (gtk_im_context_simple_parent_class)->finalize (obj);
 }
 
 /** 
@@ -1572,17 +1540,12 @@ gtk_im_context_simple_get_preedit_string (GtkIMContext   *context,
        }
 
       g_assert (len < 25);
-      outbuf[len] = '\0';      
     }
   else if (context_simple->tentative_match)
-    {
-      len = g_unichar_to_utf8 (context_simple->tentative_match, outbuf);
-    }
-  else
-    {
-      outbuf[0] = '\0';
-    }
+    len = g_unichar_to_utf8 (context_simple->tentative_match, outbuf);
       
+  outbuf[len] = '\0';      
+
   if (str)
     *str = g_strdup (outbuf);