diff options
author | Sergey V. Udaltsov <svu@gnome.org> | 2012-02-22 23:41:59 +0000 |
---|---|---|
committer | Sergey V. Udaltsov <svu@gnome.org> | 2012-02-22 23:41:59 +0000 |
commit | d63547c01abff6a24920445455c8d2ede2eadd02 (patch) | |
tree | 3525df5c194cc2b63910882e6d507752e549d0dc /libgnomekbd | |
parent | e588c409c80fee159bc3603870abd93f7f80bf24 (diff) | |
download | libgnomekbd-d63547c01abff6a24920445455c8d2ede2eadd02.tar.gz |
Got rid of the obsolete plugins architecture
In the GNOME 3 world, there are gnome-shell extensions, there is introspection - so plugins are not necessary any more
Diffstat (limited to 'libgnomekbd')
-rw-r--r-- | libgnomekbd/Makefile.am | 9 | ||||
-rw-r--r-- | libgnomekbd/gkbd-indicator-config.c | 13 | ||||
-rw-r--r-- | libgnomekbd/gkbd-indicator-config.h | 2 | ||||
-rw-r--r-- | libgnomekbd/gkbd-indicator-plugin-manager.c | 409 | ||||
-rw-r--r-- | libgnomekbd/gkbd-indicator-plugin-manager.h | 123 | ||||
-rw-r--r-- | libgnomekbd/gkbd-indicator-plugin.h | 132 | ||||
-rw-r--r-- | libgnomekbd/gkbd-indicator.c | 56 | ||||
-rw-r--r-- | libgnomekbd/libgnomekbd.convert | 1 | ||||
-rw-r--r-- | libgnomekbd/org.gnome.libgnomekbd.gschema.xml.in.in | 5 |
9 files changed, 3 insertions, 747 deletions
diff --git a/libgnomekbd/Makefile.am b/libgnomekbd/Makefile.am index 7117f97..ed71260 100644 --- a/libgnomekbd/Makefile.am +++ b/libgnomekbd/Makefile.am @@ -23,7 +23,6 @@ common_CFLAGS = \ $(LIBXKLAVIER_CFLAGS) \ $(XLIB_CFLAGS) \ -I$(top_srcdir)/intl \ - -DSYS_PLUGIN_DIR=\"$(libdir)/gnomekbd/\" \ -DG_LOG_DOMAIN=\"GnomeKbdIndicator\" \ -DDATADIR=\"$(datadir)\" \ -DICONSDIR=\"$(iconsdir)\" \ @@ -65,7 +64,6 @@ libgnomekbdui_la_SOURCES = \ gkbd-indicator.c \ gkbd-status.c \ gkbd-indicator-marshal.c \ - gkbd-indicator-plugin-manager.c \ gkbd-keyboard-drawing-marshal.c \ gkbd-keyboard-drawing.c @@ -107,7 +105,6 @@ gnomekbdinc_HEADERS = \ gkbd-indicator.h \ gkbd-status.h \ gkbd-indicator-config.h \ - gkbd-indicator-plugin.h \ gkbd-keyboard-drawing.h \ gkbd-util.h @@ -117,8 +114,7 @@ sys_DATA = $(sys_in_in_files:.desktop.in.in=.desktop) @INTLTOOL_DESKTOP_RULE@ -noinst_HEADERS = gkbd-indicator-plugin-manager.h \ - $(extra_nih) \ +noinst_HEADERS = $(extra_nih) \ gkbd-config-private.h convertdir = $(datadir)/GConf/gsettings @@ -161,8 +157,7 @@ INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) if HAVE_INTROSPECTION introspection_sources = $(gnomekbdinc_HEADERS) \ $(libgnomekbd_la_SOURCES) \ - $(libgnomekbdui_la_SOURCES) \ - gkbd-indicator-plugin-manager.h + $(libgnomekbdui_la_SOURCES) Gkbd-3.0.gir: libgnomekbd.la libgnomekbdui.la Gkbd_3_0_gir_INCLUDES = GObject-2.0 Gtk-3.0 xlib-2.0 Xkl-1.0 diff --git a/libgnomekbd/gkbd-indicator-config.c b/libgnomekbd/gkbd-indicator-config.c index c678643..fce70b2 100644 --- a/libgnomekbd/gkbd-indicator-config.c +++ b/libgnomekbd/gkbd-indicator-config.c @@ -39,8 +39,6 @@ */ const gchar GKBD_INDICATOR_CONFIG_KEY_SHOW_FLAGS[] = "show-flags"; -const gchar GKBD_INDICATOR_CONFIG_KEY_ENABLED_PLUGINS[] = - "enabled-plugins"; const gchar GKBD_INDICATOR_CONFIG_KEY_SECONDARIES[] = "secondary"; const gchar GKBD_INDICATOR_CONFIG_KEY_FONT_FAMILY[] = "font-family"; const gchar GKBD_INDICATOR_CONFIG_KEY_FONT_SIZE[] = "font-size"; @@ -280,8 +278,6 @@ gkbd_indicator_config_term (GkbdIndicatorConfig * ind_config) gkbd_indicator_config_free_image_filenames (ind_config); - g_strfreev (ind_config->enabled_plugins); - ind_config->enabled_plugins = NULL; g_object_unref (ind_config->settings); ind_config->settings = NULL; } @@ -299,11 +295,6 @@ gkbd_indicator_config_load (GkbdIndicatorConfig * ind_config) gkbd_indicator_config_load_font (ind_config); gkbd_indicator_config_load_colors (ind_config); - - g_strfreev (ind_config->enabled_plugins); - ind_config->enabled_plugins = - g_settings_get_strv (ind_config->settings, - GKBD_INDICATOR_CONFIG_KEY_ENABLED_PLUGINS); } void @@ -317,10 +308,6 @@ gkbd_indicator_config_save (GkbdIndicatorConfig * ind_config) g_settings_set_boolean (ind_config->settings, GKBD_INDICATOR_CONFIG_KEY_SHOW_FLAGS, ind_config->show_flags); - g_settings_set_strv (ind_config->settings, - GKBD_INDICATOR_CONFIG_KEY_ENABLED_PLUGINS, - (const gchar * - const *) ind_config->enabled_plugins); g_settings_apply (ind_config->settings); } diff --git a/libgnomekbd/gkbd-indicator-config.h b/libgnomekbd/gkbd-indicator-config.h index 9b9d935..3c1515b 100644 --- a/libgnomekbd/gkbd-indicator-config.h +++ b/libgnomekbd/gkbd-indicator-config.h @@ -37,8 +37,6 @@ struct _GkbdIndicatorConfig { gchar *foreground_color; gchar *background_color; - gchar **enabled_plugins; - /* private, transient */ GSettings *settings; GSList *image_filenames; diff --git a/libgnomekbd/gkbd-indicator-plugin-manager.c b/libgnomekbd/gkbd-indicator-plugin-manager.c deleted file mode 100644 index 53aa35b..0000000 --- a/libgnomekbd/gkbd-indicator-plugin-manager.c +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Copyright (C) 2006 Sergey V. Udaltsov <svu@gnome.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <config.h> - -#include <string.h> - -#include <libxklavier/xklavier.h> - -#include <gkbd-indicator-plugin-manager.h> -#include <gkbd-config-private.h> -#include <gkbd-util.h> - -#define FOREACH_INITED_PLUGIN() \ -{ \ - GSList *prec; \ - for( prec = manager->inited_plugin_recs; prec != NULL; prec = prec->next ) \ - { \ - const GkbdIndicatorPlugin *plugin = \ - ( ( GkbdIndicatorPluginManagerRecord * ) ( prec->data ) )->plugin; \ - if( plugin != NULL ) \ - { - -#define NEXT_INITED_PLUGIN() \ - } \ - } \ -} - -static void -gkbd_indicator_plugin_manager_add_plugins_dir (GkbdIndicatorPluginManager * - manager, - const char *dirname) -{ - GDir *dir = g_dir_open (dirname, 0, NULL); - const gchar *filename; - const GkbdIndicatorPlugin *plugin; - - if (dir == NULL) - return; - - xkl_debug (100, "Scanning [%s]...\n", dirname); - while ((filename = g_dir_read_name (dir)) != NULL) { - gchar *full_path = - g_build_filename (dirname, filename, NULL); - xkl_debug (100, "Loading plugin module [%s]...\n", - full_path); - if (full_path != NULL) { - GModule *module = g_module_open (full_path, 0); - if (module != NULL) { - gpointer get_plugin_func; - if (g_module_symbol - (module, "GetPlugin", - &get_plugin_func)) { - plugin = - ((GkbdIndicatorPluginGetPluginFunc) - get_plugin_func) (); - if (plugin != NULL) { - GkbdIndicatorPluginManagerRecord - * rec = - g_new0 - (GkbdIndicatorPluginManagerRecord, - 1); - xkl_debug (100, - "Loaded plugin from [%s]: [%s]/[%s]...\n", - full_path, - plugin->name, - plugin-> - description); - rec->full_path = full_path; - rec->module = module; - rec->plugin = plugin; - g_hash_table_insert - (manager-> - all_plugin_recs, - full_path, rec); - continue; - } - } else - xkl_debug (0, - "Bad plugin: [%s]\n", - full_path); - g_module_close (module); - } else - xkl_debug (0, "Bad module: [%s], %s\n", - full_path, g_module_error ()); - g_free (full_path); - } - } - g_dir_close (dir); -} - -static void -gkbd_indicator_plugin_manager_load_all (GkbdIndicatorPluginManager * - manager) -{ - if (!g_module_supported ()) { - xkl_debug (0, "Modules are not supported - no plugins!\n"); - return; - } - gkbd_indicator_plugin_manager_add_plugins_dir (manager, - SYS_PLUGIN_DIR); -} - -static void -gkbd_indicator_plugin_manager_rec_term (GkbdIndicatorPluginManagerRecord * - rec, void *user_data) -{ - const GkbdIndicatorPlugin *plugin = rec->plugin; - if (plugin != NULL) { - xkl_debug (100, "Terminating plugin: [%s]...\n", - plugin->name); - if (plugin->term_callback) - (*plugin->term_callback) (); - } -} - -static void -gkbd_indicator_plugin_manager_rec_destroy (GkbdIndicatorPluginManagerRecord - * rec) -{ - xkl_debug (100, "Unloading plugin: [%s]...\n", rec->plugin->name); - - g_module_close (rec->module); - g_free (rec); -} - -void -gkbd_indicator_plugin_manager_init (GkbdIndicatorPluginManager * manager) -{ - manager->all_plugin_recs = - g_hash_table_new_full (g_str_hash, g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) - gkbd_indicator_plugin_manager_rec_destroy); - gkbd_indicator_plugin_manager_load_all (manager); -} - -void -gkbd_indicator_plugin_manager_term (GkbdIndicatorPluginManager * manager) -{ - gkbd_indicator_plugin_manager_term_initialized_plugins (manager); - if (manager->all_plugin_recs != NULL) { - g_hash_table_destroy (manager->all_plugin_recs); - manager->all_plugin_recs = NULL; - } -} - -void - gkbd_indicator_plugin_manager_init_enabled_plugins - (GkbdIndicatorPluginManager * manager, - GkbdIndicatorPluginContainer * pc, gchar ** enabled_plugins) { - gchar **plugin_name_node = enabled_plugins; - if (manager->all_plugin_recs == NULL) - return; - xkl_debug (100, "Initializing all enabled plugins...\n"); - if (plugin_name_node != NULL) { - while (*plugin_name_node != NULL) { - const char *full_path = *plugin_name_node; - if (full_path != NULL) { - GkbdIndicatorPluginManagerRecord *rec = - (GkbdIndicatorPluginManagerRecord *) - g_hash_table_lookup - (manager->all_plugin_recs, - full_path); - - if (rec != NULL) { - const GkbdIndicatorPlugin *plugin = - rec->plugin; - gboolean initialized = FALSE; - xkl_debug (100, - "Initializing plugin: [%s] from [%s]...\n", - plugin->name, - full_path); - if (plugin->init_callback != NULL) - initialized = - (*plugin-> - init_callback) - (pc); - else - initialized = TRUE; - - manager->inited_plugin_recs = - g_slist_append - (manager->inited_plugin_recs, - rec); - xkl_debug (100, - "Plugin [%s] initialized: %d\n", - plugin->name, - initialized); - } - } - plugin_name_node++; - } - } -} - -void - gkbd_indicator_plugin_manager_term_initialized_plugins - (GkbdIndicatorPluginManager * manager) { - - if (manager->inited_plugin_recs == NULL) - return; - g_slist_foreach (manager->inited_plugin_recs, - (GFunc) gkbd_indicator_plugin_manager_rec_term, - NULL); - g_slist_free (manager->inited_plugin_recs); - manager->inited_plugin_recs = NULL; -} - -void -gkbd_indicator_plugin_manager_toggle_plugins (GkbdIndicatorPluginManager * - manager, - GkbdIndicatorPluginContainer - * pc, - gchar ** enabled_plugins) -{ - gkbd_indicator_plugin_manager_term_initialized_plugins (manager); - gkbd_indicator_plugin_manager_init_enabled_plugins (manager, pc, - enabled_plugins); -} - -void -gkbd_indicator_plugin_manager_group_changed (GkbdIndicatorPluginManager * - manager, GtkWidget * notebook, - int new_group) -{ - FOREACH_INITED_PLUGIN (); - if (plugin->group_changed_callback) - (*plugin->group_changed_callback) (notebook, new_group); - NEXT_INITED_PLUGIN (); -} - -void -gkbd_indicator_plugin_manager_config_changed (GkbdIndicatorPluginManager * - manager, - GkbdKeyboardConfig * from, - GkbdKeyboardConfig * to) -{ - FOREACH_INITED_PLUGIN (); - if (plugin->config_changed_callback) - (*plugin->config_changed_callback) (from, to); - NEXT_INITED_PLUGIN (); -} - -const GkbdIndicatorPlugin * -gkbd_indicator_plugin_manager_get_plugin (GkbdIndicatorPluginManager * - manager, const char *full_path) -{ - GkbdIndicatorPluginManagerRecord *rec = - (GkbdIndicatorPluginManagerRecord *) - g_hash_table_lookup (manager->all_plugin_recs, - full_path); - if (rec == NULL) - return NULL; - return rec->plugin; -} - -void -gkbd_indicator_plugin_manager_promote_plugin (GkbdIndicatorPluginManager * - manager, - gchar ** enabled_plugins, - const char *full_path) -{ - gchar **the_node = enabled_plugins; - gchar **prev_node = NULL; - - if (the_node != NULL) { - while (*the_node != NULL) { - if (!strcmp (*the_node, full_path)) { - if (prev_node != NULL) { - char *tmp = *prev_node; - *prev_node = *the_node; - *the_node = tmp; - } - break; - } - prev_node = the_node; - the_node++; - } - } -} - -void -gkbd_indicator_plugin_manager_demote_plugin (GkbdIndicatorPluginManager * - manager, - gchar ** enabled_plugins, - const char *full_path) -{ - gchar **the_node = enabled_plugins; - if (the_node != NULL) { - while (*the_node != NULL) { - if (!strcmp (*the_node, full_path)) { - gchar **next_node = the_node + 1; - if (*next_node != NULL) { - char *tmp = *next_node; - *next_node = *the_node; - *the_node = tmp; - } - } - the_node++; - } - } -} - -void - gkbd_indicator_plugin_manager_enable_plugin - (GkbdIndicatorPluginManager * manager, - gchar *** enabled_plugins, const char *full_path) { - if (NULL != - gkbd_indicator_plugin_manager_get_plugin (manager, - full_path)) { - *enabled_plugins = - gkbd_strv_append (*enabled_plugins, - g_strdup (full_path)); - } -} - -void - gkbd_indicator_plugin_manager_disable_plugin - (GkbdIndicatorPluginManager * manager, - gchar *** enabled_plugins, const char *full_path) { - gkbd_strv_remove (*enabled_plugins, full_path); -} - -int - gkbd_indicator_plugin_manager_window_created - (GkbdIndicatorPluginManager * manager, Window win, Window parent) { - FOREACH_INITED_PLUGIN (); - if (plugin->window_created_callback) { - int group_to_assign = - (*plugin->window_created_callback) (win, - parent); - if (group_to_assign != -1) { - xkl_debug (100, - "Plugin [%s] assigned group %d to new window %ld\n", - plugin->name, group_to_assign, win); - return group_to_assign; - } - } - NEXT_INITED_PLUGIN (); - return -1; -} - -/** - * gkbd_indicator_plugin_manager_decorate_widget: - * Returns: (transfer full): A widget to use - */ -GtkWidget - * gkbd_indicator_plugin_manager_decorate_widget - (GkbdIndicatorPluginManager * manager, GtkWidget * widget, - const gint group, const char *group_description, - GkbdKeyboardConfig * kbd_config) { - FOREACH_INITED_PLUGIN (); - if (plugin->decorate_widget_callback) { - GtkWidget *decorated_widget = - (*plugin->decorate_widget_callback) (widget, - group, - group_description, - kbd_config); - if (decorated_widget != NULL) { - xkl_debug (100, - "Plugin [%s] decorated widget %p to %p\n", - plugin->name, widget, decorated_widget); - return decorated_widget; - } - } - NEXT_INITED_PLUGIN (); - return NULL; -} - -void - gkbd_indicator_plugin_manager_configure_plugin - (GkbdIndicatorPluginManager * manager, - GkbdIndicatorPluginContainer * pc, const char *full_path, - GtkWindow * parent) { - const GkbdIndicatorPlugin *plugin = - gkbd_indicator_plugin_manager_get_plugin (manager, - full_path); - if (plugin->configure_properties_callback != NULL) - plugin->configure_properties_callback (pc, parent); -} - -void -gkbd_indicator_plugin_container_init (GkbdIndicatorPluginContainer * pc) -{ - pc->settings = g_settings_new ("org.gnome.libgnomekbd.indicator"); -} - -void -gkbd_indicator_plugin_container_term (GkbdIndicatorPluginContainer * pc) -{ - g_object_unref (pc->settings); -} diff --git a/libgnomekbd/gkbd-indicator-plugin-manager.h b/libgnomekbd/gkbd-indicator-plugin-manager.h deleted file mode 100644 index f1371c3..0000000 --- a/libgnomekbd/gkbd-indicator-plugin-manager.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C) 2006 Sergey V. Udaltsov <svu@gnome.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GSWITCHIT_PLUGIN_MANAGER_H__ -#define __GSWITCHIT_PLUGIN_MANAGER_H__ - -#include <gmodule.h> -#include <libgnomekbd/gkbd-indicator-plugin.h> - -typedef struct _GkbdIndicatorPluginManager GkbdIndicatorPluginManager; -struct _GkbdIndicatorPluginManager { - GHashTable *all_plugin_recs; - GSList *inited_plugin_recs; -}; - -typedef struct _GkbdIndicatorPluginManagerRecord GkbdIndicatorPluginManagerRecord; -struct _GkbdIndicatorPluginManagerRecord { - const char *full_path; - GModule *module; - const GkbdIndicatorPlugin *plugin; -}; - -extern void - gkbd_indicator_plugin_manager_init (GkbdIndicatorPluginManager * manager); - -extern void - gkbd_indicator_plugin_manager_term (GkbdIndicatorPluginManager * manager); - -extern void - gkbd_indicator_plugin_manager_init_enabled_plugins - (GkbdIndicatorPluginManager * manager, - GkbdIndicatorPluginContainer * pc, gchar ** enabled_plugins); - -extern void - gkbd_indicator_plugin_manager_term_initialized_plugins - (GkbdIndicatorPluginManager * manager); - -extern void -gkbd_indicator_plugin_manager_toggle_plugins (GkbdIndicatorPluginManager * - manager, - GkbdIndicatorPluginContainer - * pc, - gchar ** enabled_plugins); - -extern const GkbdIndicatorPlugin * -gkbd_indicator_plugin_manager_get_plugin (GkbdIndicatorPluginManager * - manager, const char *full_path); - -extern void -gkbd_indicator_plugin_manager_promote_plugin (GkbdIndicatorPluginManager * - manager, - gchar ** enabled_plugins, - const char *full_path); - -extern void -gkbd_indicator_plugin_manager_demote_plugin (GkbdIndicatorPluginManager * - manager, - gchar ** enabled_plugins, - const char *full_path); - -extern void -gkbd_indicator_plugin_manager_enable_plugin (GkbdIndicatorPluginManager * - manager, - gchar *** enabled_plugins, - const char *full_path); - -extern void -gkbd_indicator_plugin_manager_disable_plugin (GkbdIndicatorPluginManager * - manager, - gchar *** enabled_plugins, - const char *full_path); - -extern void -gkbd_indicator_plugin_manager_configure_plugin (GkbdIndicatorPluginManager - * manager, - GkbdIndicatorPluginContainer - * pc, - const char *full_path, - GtkWindow * parent); - -/* actual calling plugin notification methods */ - -extern void -gkbd_indicator_plugin_manager_group_changed (GkbdIndicatorPluginManager * - manager, GtkWidget * notebook, - int new_group); - -extern void -gkbd_indicator_plugin_manager_config_changed (GkbdIndicatorPluginManager * - manager, - GkbdKeyboardConfig * from, - GkbdKeyboardConfig * to); - -extern int -gkbd_indicator_plugin_manager_window_created (GkbdIndicatorPluginManager * - manager, Window win, - Window parent); - -extern GtkWidget * -gkbd_indicator_plugin_manager_decorate_widget (GkbdIndicatorPluginManager * - manager, GtkWidget * widget, - const gint group, const char - *group_description, - GkbdKeyboardConfig * - config); - -#endif diff --git a/libgnomekbd/gkbd-indicator-plugin.h b/libgnomekbd/gkbd-indicator-plugin.h deleted file mode 100644 index fe77842..0000000 --- a/libgnomekbd/gkbd-indicator-plugin.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (C) 2006 Sergey V. Udaltsov <svu@gnome.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GKBD_INDICATOR_PLUGIN_H__ -#define __GKBD_INDICATOR_PLUGIN_H__ - -#include <gtk/gtk.h> -#include <libgnomekbd/gkbd-keyboard-config.h> - -#define MAX_LOCAL_NAME_BUF_LENGTH 512 - -struct _GkbdIndicatorPlugin; - -typedef struct _GkbdIndicatorPluginContainer GkbdIndicatorPluginContainer; -struct _GkbdIndicatorPluginContainer { - GSettings *settings; -}; - -typedef const struct _GkbdIndicatorPlugin -*(*GkbdIndicatorPluginGetPluginFunc) (void); - -typedef - - - -gboolean (*GkbdIndicatorPluginInitFunc) (GkbdIndicatorPluginContainer * - pc); - -typedef void (*GkbdIndicatorPluginGroupChangedFunc) (GtkWidget * notebook, - int new_group); - -typedef void (*GkbdIndicatorPluginConfigChangedFunc) (const - GkbdKeyboardConfig * - from, - const - GkbdKeyboardConfig * - to); - -typedef int (*GkbdIndicatorPluginWindowCreatedFunc) (const Window win, - const Window parent); - -typedef void (*GkbdIndicatorPluginTermFunc) (void); - -typedef GtkWidget *(*GkbdIndicatorPluginCreateWidget) (void); - -typedef GtkWidget *(*GkbdIndicatorPluginDecorateWidget) (GtkWidget * - widget, - const gint group, - const char - *group_description, - GkbdKeyboardConfig - * config); - -typedef -void (*GkbdIndicatorPluginConfigureProperties) - (GkbdIndicatorPluginContainer * pc, GtkWindow * parent); - -typedef struct _GkbdIndicatorPlugin GkbdIndicatorPlugin; -struct _GkbdIndicatorPlugin { - const char *name; - - const char *description; - -/* implemented */ - GkbdIndicatorPluginInitFunc init_callback; - -/* implemented */ - GkbdIndicatorPluginTermFunc term_callback; - -/* implemented */ - GkbdIndicatorPluginConfigureProperties - configure_properties_callback; - -/* implemented */ - GkbdIndicatorPluginGroupChangedFunc group_changed_callback; - -/* implemented */ - GkbdIndicatorPluginWindowCreatedFunc window_created_callback; - -/* implemented */ - GkbdIndicatorPluginDecorateWidget decorate_widget_callback; - -/* not implemented */ - GkbdIndicatorPluginConfigChangedFunc config_changed_callback; - -/* not implemented */ - GkbdIndicatorPluginCreateWidget create_widget_callback; - -}; - -/** - * Functions accessible for plugins - */ - -extern void - gkbd_indicator_plugin_container_init (GkbdIndicatorPluginContainer * pc); - -extern void - gkbd_indicator_plugin_container_term (GkbdIndicatorPluginContainer * pc); - -extern void - - - -gkbd_indicator_plugin_container_reinit_ui (GkbdIndicatorPluginContainer * - pc); - -extern guint -gkbd_indicator_plugin_get_num_groups (GkbdIndicatorPluginContainer * pc); - -extern gchar - ** - gkbd_indicator_plugin_load_localized_group_names - (GkbdIndicatorPluginContainer * pc); - -#endif diff --git a/libgnomekbd/gkbd-indicator.c b/libgnomekbd/gkbd-indicator.c index d85339a..413284b 100644 --- a/libgnomekbd/gkbd-indicator.c +++ b/libgnomekbd/gkbd-indicator.c @@ -32,14 +32,9 @@ #include <gkbd-indicator-config.h> #include <gkbd-configuration.h> -#include <gkbd-indicator-plugin-manager.h> - typedef struct _gki_globals { GkbdConfiguration *config; - GkbdIndicatorPluginContainer plugin_container; - GkbdIndicatorPluginManager plugin_manager; - GSList *images; } gki_globals; @@ -110,7 +105,7 @@ gkbd_indicator_fill (GkbdIndicator * gki) gkbd_configuration_get_group_names (globals.config); for (grp = 0; grp < total_groups; grp++) { - GtkWidget *page, *decorated_page = NULL; + GtkWidget *page = NULL; gchar *full_group_name = (grp < g_strv_length (full_group_names)) ? @@ -120,15 +115,6 @@ gkbd_indicator_fill (GkbdIndicator * gki) if (page == NULL) page = gtk_label_new (""); - decorated_page = - gkbd_indicator_plugin_manager_decorate_widget - (&globals.plugin_manager, page, grp, - full_group_name, - gkbd_configuration_get_keyboard_config - (globals.config)); - - page = decorated_page == NULL ? page : decorated_page; - gtk_notebook_append_page (notebook, page, NULL); gtk_widget_show_all (page); } @@ -299,11 +285,6 @@ gkbd_indicator_reinit_ui (GkbdIndicator * gki) static void gkbd_indicator_cfg_callback (GkbdConfiguration * configuration) { - gkbd_indicator_plugin_manager_toggle_plugins - (&globals.plugin_manager, &globals.plugin_container, - gkbd_configuration_get_indicator_config (globals. - config)->enabled_plugins); - ForAllObjects (configuration) { gkbd_indicator_reinit_ui (GKBD_INDICATOR (gki)); } NextObject () @@ -315,8 +296,6 @@ gkbd_indicator_state_callback (GkbdConfiguration * configuration, gint group) { ForAllObjects (configuration) { - gkbd_indicator_plugin_manager_group_changed - (&globals.plugin_manager, GTK_WIDGET (gki), group); xkl_debug (200, "do repaint\n"); gkbd_indicator_set_current_page_for_group (GKBD_INDICATOR (gki), group); @@ -487,11 +466,6 @@ gkbd_indicator_global_term (void) gkbd_configuration_free_images (globals.config, globals.images); globals.images = NULL; - gkbd_indicator_plugin_manager_term_initialized_plugins - (&globals.plugin_manager); - gkbd_indicator_plugin_manager_term (&globals.plugin_manager); - gkbd_indicator_plugin_container_term (&globals.plugin_container); - gkbd_indicator_stop_listen (); g_object_unref (globals.config); globals.config = NULL; @@ -534,16 +508,8 @@ gkbd_indicator_global_init (void) g_signal_connect (globals.config, "changed", G_CALLBACK (gkbd_indicator_cfg_callback), NULL); - gkbd_indicator_plugin_container_init (&globals.plugin_container); - globals.images = gkbd_configuration_load_images (globals.config); - gkbd_indicator_plugin_manager_init (&globals.plugin_manager); - gkbd_indicator_plugin_manager_init_enabled_plugins - (&globals.plugin_manager, &globals.plugin_container, - gkbd_configuration_get_indicator_config (globals. - config)->enabled_plugins); - gkbd_indicator_start_listen (); xkl_debug (100, "*** Inited globals *** \n"); @@ -616,23 +582,3 @@ gkbd_indicator_set_angle (GkbdIndicator * gki, gdouble angle) gki->priv->angle = angle; } -/* Plugin support */ -/* Preserve the plugin container functions during the linking */ -void -gkbd_indicator_plugin_container_reinit_ui (GkbdIndicatorPluginContainer * - pc) -{ - ForAllObjects (globals.config) { - gkbd_indicator_reinit_ui (GKBD_INDICATOR (gki)); - } NextObject () -} - -/** - * gkbd_indicator_plugin_load_localized_group_names: - * Returns: (transfer none) (array zero-terminated=1): all group names - */ -gchar **gkbd_indicator_plugin_load_localized_group_names - (GkbdIndicatorPluginContainer * pc) { - return (gchar **) - gkbd_configuration_get_group_names (globals.config); -} diff --git a/libgnomekbd/libgnomekbd.convert b/libgnomekbd/libgnomekbd.convert index 388edf2..991a8ae 100644 --- a/libgnomekbd/libgnomekbd.convert +++ b/libgnomekbd/libgnomekbd.convert @@ -18,7 +18,6 @@ font-family = /desktop/gnome/peripherals/keyboard/indicator/fontFamily font-size = /desktop/gnome/peripherals/keyboard/indicator/fontSize foreground-color = /desktop/gnome/peripherals/keyboard/indicator/foregroundColor background-color = /desktop/gnome/peripherals/keyboard/indicator/backgroundColor -enabled-plugins = /desktop/gnome/peripherals/keyboard/indicator/enabledPlugins [org.gnome.libgnomekbd.keyboard] model = /desktop/gnome/peripherals/keyboard/kbd/model diff --git a/libgnomekbd/org.gnome.libgnomekbd.gschema.xml.in.in b/libgnomekbd/org.gnome.libgnomekbd.gschema.xml.in.in index 450d6a4..ea3dcce 100644 --- a/libgnomekbd/org.gnome.libgnomekbd.gschema.xml.in.in +++ b/libgnomekbd/org.gnome.libgnomekbd.gschema.xml.in.in @@ -63,10 +63,5 @@ <_summary>The background color</_summary> <_description>The background color for the layout indicator</_description> </key> - <key name="enabled-plugins" type="as"> - <default>[]</default> - <_summary>The list of enabled Keyboard Indicator plugins</_summary> - <_description>The list of enabled Keyboard Indicator plugins</_description> - </key> </schema> </schemalist> |