[gtranslator] Update to new libpeas API
- From: Garrett Regier <gregier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator] Update to new libpeas API
- Date: Sat, 7 Apr 2012 10:58:27 +0000 (UTC)
commit 1b172c5c838378f6df5ec3b5168427ebca2c5a4f
Author: Garrett Regier <garrettregier gmail com>
Date: Sat Apr 7 03:52:46 2012 -0700
Update to new libpeas API
configure.ac | 2 +-
src/gtr-tab.c | 9 ++++++---
src/gtr-window.c | 34 +++++++++++++++++++++++++++-------
3 files changed, 34 insertions(+), 11 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d07d106..bb46732 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,7 +87,7 @@ LIBXML_REQUIRED=2.4.12
SOURCEVIEW_REQUIRED=3.0.0
GDL_REQUIRED=2.91.1
GDA_REQUIRED=4.2.3
-PEAS_REQUIRED=1.0.0
+PEAS_REQUIRED=1.2.0
GDICT_OPTIONAL=0.11.0
GTKSPELL_OPTIONAL=2.99.99
JSON_GLIB_OPTIONAL=0.12.0
diff --git a/src/gtr-tab.c b/src/gtr-tab.c
index 7070dc4..e24465b 100644
--- a/src/gtr-tab.c
+++ b/src/gtr-tab.c
@@ -818,7 +818,7 @@ extension_added (PeasExtensionSet *extensions,
PeasExtension *exten,
GtrTab *tab)
{
- peas_extension_call (exten, "activate");
+ gtr_tab_activatable_activate (GTR_TAB_ACTIVATABLE (exten));
}
static void
@@ -827,7 +827,7 @@ extension_removed (PeasExtensionSet *extensions,
PeasExtension *exten,
GtrTab *tab)
{
- peas_extension_call (exten, "deactivate");
+ gtr_tab_activatable_deactivate (GTR_TAB_ACTIVATABLE (exten));
}
static void
@@ -862,6 +862,7 @@ gtr_tab_init (GtrTab * tab)
GTR_TYPE_TAB_ACTIVATABLE,
"tab", tab,
NULL);
+
g_signal_connect (tab->priv->extensions,
"extension-added",
G_CALLBACK (extension_added),
@@ -999,7 +1000,9 @@ gtr_tab_realize (GtkWidget *widget)
/* We only activate the extensions when the tab is realized,
* because most plugins will expect this behaviour. */
- peas_extension_set_call (tab->priv->extensions, "activate");
+ peas_extension_set_foreach (tab->priv->extensions,
+ (PeasExtensionSetForeachFunc) extension_added,
+ tab);
/* Loading dock layout */
filename = g_build_filename (gtr_dirs_get_user_config_dir (),
diff --git a/src/gtr-window.c b/src/gtr-window.c
index d073e86..da8565a 100644
--- a/src/gtr-window.c
+++ b/src/gtr-window.c
@@ -271,6 +271,23 @@ static void profile_combo_changed (GtrStatusComboBox *combo,
GtkMenuItem *item,
GtrWindow *window);
+static void
+extension_update_state (PeasExtensionSet *extensions,
+ PeasPluginInfo *info,
+ PeasExtension *exten,
+ GtrWindow *window)
+{
+ gtr_window_activatable_update_state (GTR_WINDOW_ACTIVATABLE (exten));
+}
+
+static void
+extensions_update_state (GtrWindow *window)
+{
+ peas_extension_set_foreach (window->priv->extensions,
+ (PeasExtensionSetForeachFunc) extension_update_state,
+ window);
+}
+
void
_gtr_window_set_sensitive_according_to_message (GtrWindow * window,
GtrPo * po)
@@ -385,7 +402,7 @@ set_sensitive_according_to_tab (GtrWindow * window, GtrTab * tab)
_gtr_window_set_sensitive_according_to_message (window, po);
- peas_extension_set_call (window->priv->extensions, "update_state", window);
+ extensions_update_state (window);
}
static void
@@ -783,7 +800,7 @@ notebook_switch_page (GtkNotebook * nb,
if (action != NULL)
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
- peas_extension_set_call (window->priv->extensions, "update_state", window);
+ extensions_update_state (window);
}
static void
@@ -816,7 +833,7 @@ notebook_tab_close_request (GtrNotebook * notebook,
* seems to be ok, but we need to keep an eye on this. */
gtr_close_tab (tab, window);
- peas_extension_set_call (window->priv->extensions, "update_state", window);
+ extensions_update_state (window);
}
static void
@@ -937,7 +954,7 @@ notebook_tab_added (GtkNotebook * notebook,
update_documents_list_menu (window);
- peas_extension_set_call (window->priv->extensions, "update_state", window);
+ extensions_update_state (window);
}
void
@@ -1475,7 +1492,7 @@ extension_added (PeasExtensionSet *extensions,
PeasExtension *exten,
GtrWindow *window)
{
- peas_extension_call (exten, "activate");
+ gtr_window_activatable_activate (GTR_WINDOW_ACTIVATABLE (exten));
}
static void
@@ -1484,7 +1501,7 @@ extension_removed (PeasExtensionSet *extensions,
PeasExtension *exten,
GtrWindow *window)
{
- peas_extension_call (exten, "deactivate");
+ gtr_window_activatable_deactivate (GTR_WINDOW_ACTIVATABLE (exten));
/* Ensure update of ui manager, because we suspect it does something
* with expected static strings in the type module (when unloaded the
@@ -1550,6 +1567,10 @@ gtr_window_init (GtrWindow * window)
GTR_TYPE_WINDOW_ACTIVATABLE,
"window", window,
NULL);
+ peas_extension_set_foreach (window->priv->extensions,
+ (PeasExtensionSetForeachFunc) extension_added,
+ window);
+
g_signal_connect (window->priv->extensions,
"extension-added",
G_CALLBACK (extension_added),
@@ -1558,7 +1579,6 @@ gtr_window_init (GtrWindow * window)
"extension-removed",
G_CALLBACK (extension_removed),
window);
- peas_extension_set_call (window->priv->extensions, "activate");
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]