From af87f5ee161f1cfeab85cd0e19e8c77f6b89ee76 Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Wed, 7 Mar 2012 00:41:14 -0500 Subject: [PATCH] Remove some unused code. BUG=None TEST=Make Review URL: https://codereview.appspot.com/5756061 --- bus/ibusimpl.c | 20 --------------- client/x11/gdk-private.c | 64 ------------------------------------------------ src/ibuscomponent.c | 15 ------------ src/ibusconfigservice.c | 41 ------------------------------- src/ibusshare.c | 51 -------------------------------------- 5 files changed, 191 deletions(-) diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c index 7d80457..10a6a18 100644 --- a/bus/ibusimpl.c +++ b/bus/ibusimpl.c @@ -103,26 +103,6 @@ static void bus_ibus_impl_service_method_call GVariant *parameters, GDBusMethodInvocation *invocation); -/* TODO use property to replace some getter and setter in future */ -#if 0 -static GVariant *ibus_ibus_impl_service_get_property - (IBusService *service, - GDBusConnection *connection, - const gchar *sender, - const gchar *object_path, - const gchar *interface_name, - const gchar *property_name, - GError **error); -static gboolean ibus_ibus_impl_service_set_property - (IBusService *service, - GDBusConnection *connection, - const gchar *sender, - const gchar *object_path, - const gchar *interface_name, - const gchar *property_name, - GVariant *value, - GError **error); -#endif static void bus_ibus_impl_registry_changed (BusIBusImpl *ibus); static void bus_ibus_impl_global_engine_changed (BusIBusImpl *ibus); diff --git a/client/x11/gdk-private.c b/client/x11/gdk-private.c index 9e42a3a..009a5b0 100644 --- a/client/x11/gdk-private.c +++ b/client/x11/gdk-private.c @@ -38,10 +38,6 @@ translate_key_event (GdkDisplay *display, XEvent *xevent) { GdkKeymap *keymap = gdk_keymap_get_for_display (display); -#if 0 - gunichar c = 0; - gchar buf[7]; -#endif event->key.type = xevent->xany.type == KeyPress ? GDK_KEY_PRESS : GDK_KEY_RELEASE; event->key.time = xevent->xkey.time; @@ -64,10 +60,6 @@ translate_key_event (GdkDisplay *display, event->key.group, &event->key.keyval, NULL, NULL, NULL); -#if 0 - _gdk_keymap_add_virtual_modifiers (keymap, &event->key.state); - event->key.is_modifier = _gdk_keymap_key_is_modifier (keymap, event->key.hardware_keycode); -#endif event->key.is_modifier = 0; /* Fill in event->string crudely, since various programs @@ -76,62 +68,6 @@ translate_key_event (GdkDisplay *display, event->key.string = NULL; event->key.length = 0; - /* Don't need event->string. - */ -#if 0 - if (event->key.keyval != GDK_VoidSymbol) - c = gdk_keyval_to_unicode (event->key.keyval); - - if (c) - { - gsize bytes_written; - gint len; - - /* Apply the control key - Taken from Xlib - */ - if (event->key.state & GDK_CONTROL_MASK) - { - if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F; - else if (c == '2') - { - event->key.string = g_memdup ("\0\0", 2); - event->key.length = 1; - buf[0] = '\0'; - goto out; - } - else if (c >= '3' && c <= '7') c -= ('3' - '\033'); - else if (c == '8') c = '\177'; - else if (c == '/') c = '_' & 0x1F; - } - - len = g_unichar_to_utf8 (c, buf); - buf[len] = '\0'; - - event->key.string = g_locale_from_utf8 (buf, len, - NULL, &bytes_written, - NULL); - if (event->key.string) - event->key.length = bytes_written; - } - else if (event->key.keyval == GDK_Escape) - { - event->key.length = 1; - event->key.string = g_strdup ("\033"); - } - else if (event->key.keyval == GDK_Return || - event->key.keyval == GDK_KP_Enter) - { - event->key.length = 1; - event->key.string = g_strdup ("\r"); - } - - if (!event->key.string) - { - event->key.length = 0; - event->key.string = g_strdup (""); - } - out: -#endif return; } diff --git a/src/ibuscomponent.c b/src/ibuscomponent.c index 6d21b66..e93a3b0 100644 --- a/src/ibuscomponent.c +++ b/src/ibuscomponent.c @@ -219,21 +219,6 @@ static void ibus_component_init (IBusComponent *component) { component->priv = IBUS_COMPONENT_GET_PRIVATE (component); - - /* FIXME: Is it necessary? */ -#if 0 - component->priv->engines = NULL; - component->priv->observed_paths = NULL; - - component->priv->name = NULL; - component->priv->description = NULL; - component->priv->version = NULL; - component->priv->license = NULL; - component->priv->author = NULL; - component->priv->homepage = NULL; - component->priv->exec = NULL; - component->priv->textdomain = NULL; -#endif } static void diff --git a/src/ibusconfigservice.c b/src/ibusconfigservice.c index 937dfdd..4c21da5 100644 --- a/src/ibusconfigservice.c +++ b/src/ibusconfigservice.c @@ -30,19 +30,9 @@ enum { PROP_0, }; -// static guint config_service_signals[LAST_SIGNAL] = { 0 }; - /* functions prototype */ static void ibus_config_service_class_init (IBusConfigServiceClass *class); static void ibus_config_service_init (IBusConfigService *config); -static void ibus_config_service_set_property (IBusConfigService *config, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void ibus_config_service_get_property (IBusConfigService *config, - guint prop_id, - GValue *value, - GParamSpec *pspec); static void ibus_config_service_destroy (IBusConfigService *config); static void ibus_config_service_service_method_call (IBusService *service, @@ -123,9 +113,6 @@ ibus_config_service_class_init (IBusConfigServiceClass *class) { GObjectClass *gobject_class = G_OBJECT_CLASS (class); - gobject_class->set_property = (GObjectSetPropertyFunc) ibus_config_service_set_property; - gobject_class->get_property = (GObjectGetPropertyFunc) ibus_config_service_get_property; - IBUS_OBJECT_CLASS (gobject_class)->destroy = (IBusObjectDestroyFunc) ibus_config_service_destroy; IBUS_SERVICE_CLASS (class)->service_method_call = ibus_config_service_service_method_call; @@ -146,34 +133,6 @@ ibus_config_service_init (IBusConfigService *config) } static void -ibus_config_service_set_property (IBusConfigService *config, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - switch (prop_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (config, prop_id, pspec); - } -} - -static void -ibus_config_service_get_property (IBusConfigService *config, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - switch (prop_id) { - #if 0 - case PROP_CONNECTION: - break; - #endif - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (config, prop_id, pspec); - } -} - -static void ibus_config_service_destroy (IBusConfigService *config) { IBUS_OBJECT_CLASS(ibus_config_service_parent_class)->destroy ((IBusObject *) config); diff --git a/src/ibusshare.c b/src/ibusshare.c index 9215369..95f98d3 100644 --- a/src/ibusshare.c +++ b/src/ibusshare.c @@ -69,63 +69,12 @@ const gchar * ibus_get_user_name (void) { return g_get_user_name (); -#if 0 - static gchar *username = NULL; - if (username == NULL) { - username = g_strdup (getlogin()); - if (username == NULL) - username = g_strdup (g_getenv("SUDO_USER")); - if (username == NULL) { - const gchar *uid = g_getenv ("USERHELPER_UID"); - if (uid != NULL) { - gchar *end; - uid_t id = (uid_t)strtol(uid, &end, 10); - if (uid != end) { - struct passwd *pw = getpwuid (id); - if (pw != NULL) { - username = g_strdup (pw->pw_name); - } - } - } - } - if (username == NULL) - username = g_strdup (g_getenv("USERNAME")); - if (username == NULL) - username = g_strdup (g_getenv("LOGNAME")); - if (username == NULL) - username = g_strdup (g_getenv("USER")); - if (username == NULL) - username = g_strdup (g_getenv("LNAME")); - - } - return username; -#endif } glong ibus_get_daemon_uid (void) { return getuid (); -#if 0 - struct passwd *pwd; - uid_t uid; - const gchar *username; - - uid = getuid (); - - if (uid != 0) - return uid; - - username = ibus_get_user_name (); - if (username == NULL) - return 0; - - pwd = getpwnam (username); - if (pwd == NULL) - return 0; - - return pwd->pw_uid; -#endif } const gchar * -- 2.7.4