diff options
author | Jesse van den Kieboom <jesse@icecrew.nl> | 2010-10-02 14:15:55 (GMT) |
---|---|---|
committer | Jesse van den Kieboom <jesse@icecrew.nl> | 2010-10-02 14:16:41 (GMT) |
commit | 39926499a912dc548e2b8f6435c303b1c5e1582f (patch) | |
tree | a4ca30f35e84f076152f531a2615c100b8518f4e | |
parent | efe3e649dad051dbee93de553b33a34d4181452d (diff) | |
download | gedit-collaboration-39926499a912dc548e2b8f6435c303b1c5e1582f.tar.gz gedit-collaboration-39926499a912dc548e2b8f6435c303b1c5e1582f.tar.xz |
Use GeditWindowActivatable properly
-rw-r--r-- | src/gedit-collaboration-plugin.c | 5 | ||||
-rw-r--r-- | src/gedit-collaboration-window-helper.c | 53 |
2 files changed, 32 insertions, 26 deletions
diff --git a/src/gedit-collaboration-plugin.c b/src/gedit-collaboration-plugin.c index 97771a3..9fe5642 100644 --- a/src/gedit-collaboration-plugin.c +++ b/src/gedit-collaboration-plugin.c @@ -23,6 +23,7 @@ */ #include <gedit/gedit-app-activatable.h> +#include <gedit/gedit-window-activatable.h> #include <libpeas-gtk/peas-gtk-configurable.h> #include <gedit/gedit-app.h> @@ -290,4 +291,8 @@ peas_register_types (PeasObjectModule *module) peas_object_module_register_extension_type (module, PEAS_GTK_TYPE_CONFIGURABLE, GEDIT_TYPE_COLLABORATION_PLUGIN); + + peas_object_module_register_extension_type (module, + GEDIT_TYPE_WINDOW_ACTIVATABLE, + GEDIT_TYPE_COLLABORATION_WINDOW_HELPER); } diff --git a/src/gedit-collaboration-window-helper.c b/src/gedit-collaboration-window-helper.c index a2e967c..9d71994 100644 --- a/src/gedit-collaboration-window-helper.c +++ b/src/gedit-collaboration-window-helper.c @@ -38,10 +38,32 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (GeditCollaborationWindowHelper, G_IMPLEMENT_INTERFACE_DYNAMIC (GEDIT_TYPE_WINDOW_ACTIVATABLE, gedit_window_activatable_iface_init)) +void +gedit_collaboration_window_helper_update_state (GeditWindowActivatable *activatable) +{ + GeditTab *tab; + gboolean sensitive; + GtkAction *action; + GeditCollaborationWindowHelper *helper; + + helper = GEDIT_COLLABORATION_WINDOW_HELPER (activatable); + + tab = gedit_window_get_active_tab (helper->priv->window); + + sensitive = tab != NULL && + gedit_collaboration_manager_tab_get_subscription (helper->priv->manager, + tab) != NULL; + + action = gtk_action_group_get_action (helper->priv->action_group, + "CollaborationClearColorsAction"); + + gtk_action_set_sensitive (action, sensitive); +} + static void gedit_window_activatable_iface_init (GeditWindowActivatableInterface *iface) { - /* TODO */ + iface->update_state = gedit_collaboration_window_helper_update_state; } static GdkPixbuf * @@ -151,10 +173,10 @@ user_name_data_func (GtkTreeViewColumn *tree_column, } static void -build_user_view (GeditCollaborationWindowHelper *helper, - GtkWidget **tree_view, - GtkWidget **scrolled_window, - gboolean show_colors) +build_user_view (GeditCollaborationWindowHelper *helper, + GtkWidget **tree_view, + GtkWidget **scrolled_window, + gboolean show_colors) { GtkTreeViewColumn *column; GtkCellRenderer *renderer; @@ -1641,27 +1663,6 @@ gedit_collaboration_window_helper_init (GeditCollaborationWindowHelper *self) } void -gedit_collaboration_window_helper_update_ui (GeditCollaborationWindowHelper *helper) -{ - GeditTab *tab; - gboolean sensitive; - GtkAction *action; - - g_return_if_fail (GEDIT_IS_COLLABORATION_WINDOW_HELPER (helper)); - - tab = gedit_window_get_active_tab (helper->priv->window); - - sensitive = tab != NULL && - gedit_collaboration_manager_tab_get_subscription (helper->priv->manager, - tab) != NULL; - - action = gtk_action_group_get_action (helper->priv->action_group, - "CollaborationClearColorsAction"); - - gtk_action_set_sensitive (action, sensitive); -} - -void _gedit_collaboration_window_helper_register_type (GTypeModule *module) { gedit_collaboration_window_helper_register_type (module); |