diff options
Diffstat (limited to 'plugins/time/pluma-time-plugin.c')
-rw-r--r-- | plugins/time/pluma-time-plugin.c | 411 |
1 files changed, 208 insertions, 203 deletions
diff --git a/plugins/time/pluma-time-plugin.c b/plugins/time/pluma-time-plugin.c index 1cda2c35..1266f971 100644 --- a/plugins/time/pluma-time-plugin.c +++ b/plugins/time/pluma-time-plugin.c @@ -40,7 +40,10 @@ #include <glib.h> #include <gmodule.h> #include <gio/gio.h> +#include <libpeas/peas-activatable.h> +#include <libpeas-gtk/peas-gtk-configurable.h> +#include <pluma/pluma-window.h> #include <pluma/pluma-debug.h> #include <pluma/pluma-utils.h> @@ -48,7 +51,6 @@ PLUMA_TYPE_TIME_PLUGIN, \ PlumaTimePluginPrivate)) -#define WINDOW_DATA_KEY "PlumaTimePluginWindowData" #define MENU_PATH "/MenuBar/EditMenu/EditOps_4" /* GSettings keys */ @@ -106,7 +108,7 @@ typedef struct _TimeConfigureDialog TimeConfigureDialog; struct _TimeConfigureDialog { - GtkWidget *dialog; + GtkWidget *content; GtkWidget *list; @@ -118,8 +120,7 @@ struct _TimeConfigureDialog GtkWidget *custom_entry; GtkWidget *custom_format_example; - /* Info needed for the response handler */ - PlumaTimePlugin *plugin; + GSettings *settings; }; typedef struct _ChooseFormatDialog ChooseFormatDialog; @@ -139,7 +140,8 @@ struct _ChooseFormatDialog /* Info needed for the response handler */ GtkTextBuffer *buffer; - PlumaTimePlugin *plugin; + + GSettings *settings; }; typedef enum @@ -152,24 +154,32 @@ typedef enum struct _PlumaTimePluginPrivate { - GSettings *settings; -}; + GtkWidget *window; -PLUMA_PLUGIN_REGISTER_TYPE(PlumaTimePlugin, pluma_time_plugin) + GSettings *settings; -typedef struct -{ GtkActionGroup *action_group; guint ui_id; -} WindowData; +}; -typedef struct -{ - PlumaWindow *window; - PlumaTimePlugin *plugin; -} ActionData; +enum { + PROP_0, + PROP_OBJECT +}; + +static void peas_activatable_iface_init (PeasActivatableInterface *iface); +static void peas_gtk_configurable_iface_init (PeasGtkConfigurableInterface *iface); -static void time_cb (GtkAction *action, ActionData *data); +G_DEFINE_DYNAMIC_TYPE_EXTENDED (PlumaTimePlugin, + pluma_time_plugin, + PEAS_TYPE_EXTENSION_BASE, + 0, + G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE, + peas_activatable_iface_init) + G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_GTK_TYPE_CONFIGURABLE, + peas_gtk_configurable_iface_init)) + +static void time_cb (GtkAction *action, PlumaTimePlugin *plugin); static const GtkActionEntry action_entries[] = { @@ -206,23 +216,37 @@ pluma_time_plugin_finalize (GObject *object) } static void -free_window_data (WindowData *data) +pluma_time_plugin_dispose (GObject *object) { - g_return_if_fail (data != NULL); + PlumaTimePlugin *plugin = PLUMA_TIME_PLUGIN (object); + + pluma_debug_message (DEBUG_PLUGINS, "PlumaTimePlugin disposing"); + + if (plugin->priv->window != NULL) + { + g_object_unref (plugin->priv->window); + plugin->priv->window = NULL; + } + + if (plugin->priv->action_group) + { + g_object_unref (plugin->priv->action_group); + plugin->priv->action_group = NULL; + } - g_object_unref (data->action_group); - g_free (data); + G_OBJECT_CLASS (pluma_time_plugin_parent_class)->dispose (object); } static void -update_ui_real (PlumaWindow *window, - WindowData *data) +update_ui (PlumaTimePluginPrivate *data) { + PlumaWindow *window; PlumaView *view; GtkAction *action; pluma_debug (DEBUG_PLUGINS); + window = PLUMA_WINDOW (data->window); view = pluma_window_get_active_view (window); pluma_debug_message (DEBUG_PLUGINS, "View: %p", view); @@ -235,41 +259,33 @@ update_ui_real (PlumaWindow *window, } static void -impl_activate (PlumaPlugin *plugin, - PlumaWindow *window) +pluma_time_plugin_activate (PeasActivatable *activatable) { + PlumaTimePlugin *plugin; + PlumaTimePluginPrivate *data; + PlumaWindow *window; GtkUIManager *manager; - WindowData *data; - ActionData *action_data; pluma_debug (DEBUG_PLUGINS); - data = g_new (WindowData, 1); - action_data = g_new (ActionData, 1); - - action_data->plugin = PLUMA_TIME_PLUGIN (plugin); - action_data->window = window; + plugin = PLUMA_TIME_PLUGIN (activatable); + data = plugin->priv; + window = PLUMA_WINDOW (data->window); manager = pluma_window_get_ui_manager (window); data->action_group = gtk_action_group_new ("PlumaTimePluginActions"); gtk_action_group_set_translation_domain (data->action_group, GETTEXT_PACKAGE); - gtk_action_group_add_actions_full (data->action_group, + gtk_action_group_add_actions (data->action_group, action_entries, G_N_ELEMENTS (action_entries), - action_data, - (GDestroyNotify) g_free); + plugin); gtk_ui_manager_insert_action_group (manager, data->action_group, -1); data->ui_id = gtk_ui_manager_new_merge_id (manager); - g_object_set_data_full (G_OBJECT (window), - WINDOW_DATA_KEY, - data, - (GDestroyNotify) free_window_data); - gtk_ui_manager_add_ui (manager, data->ui_id, MENU_PATH, @@ -278,41 +294,33 @@ impl_activate (PlumaPlugin *plugin, GTK_UI_MANAGER_MENUITEM, FALSE); - update_ui_real (window, data); + update_ui (data); } static void -impl_deactivate (PlumaPlugin *plugin, - PlumaWindow *window) +pluma_time_plugin_deactivate (PeasActivatable *activatable) { + PlumaTimePluginPrivate *data; + PlumaWindow *window; GtkUIManager *manager; - WindowData *data; pluma_debug (DEBUG_PLUGINS); - manager = pluma_window_get_ui_manager (window); + data = PLUMA_TIME_PLUGIN (activatable)->priv; + window = PLUMA_WINDOW (data->window); - data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY); - g_return_if_fail (data != NULL); + manager = pluma_window_get_ui_manager (window); gtk_ui_manager_remove_ui (manager, data->ui_id); gtk_ui_manager_remove_action_group (manager, data->action_group); - - g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL); } static void -impl_update_ui (PlumaPlugin *plugin, - PlumaWindow *window) +pluma_time_plugin_update_state (PeasActivatable *activatable) { - WindowData *data; - pluma_debug (DEBUG_PLUGINS); - data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY); - g_return_if_fail (data != NULL); - - update_ui_real (window, data); + update_ui (PLUMA_TIME_PLUGIN (activatable)->priv); } /* whether we should prompt the user or use the specified format */ @@ -328,16 +336,16 @@ get_prompt_type (PlumaTimePlugin *plugin) } static void -set_prompt_type (PlumaTimePlugin *plugin, +set_prompt_type (GSettings *settings, PlumaTimePluginPromptType prompt_type) { - if (!g_settings_is_writable (plugin->priv->settings, + if (!g_settings_is_writable (settings, PROMPT_TYPE_KEY)) { return; } - g_settings_set_enum (plugin->priv->settings, + g_settings_set_enum (settings, PROMPT_TYPE_KEY, prompt_type); } @@ -355,18 +363,18 @@ get_selected_format (PlumaTimePlugin *plugin) } static void -set_selected_format (PlumaTimePlugin *plugin, +set_selected_format (GSettings *settings, const gchar *format) { g_return_if_fail (format != NULL); - if (!g_settings_is_writable (plugin->priv->settings, + if (!g_settings_is_writable (settings, SELECTED_FORMAT_KEY)) { return; } - g_settings_set_string (plugin->priv->settings, + g_settings_set_string (settings, SELECTED_FORMAT_KEY, format); } @@ -384,16 +392,16 @@ get_custom_format (PlumaTimePlugin *plugin) } static void -set_custom_format (PlumaTimePlugin *plugin, +set_custom_format (GSettings *settings, const gchar *format) { g_return_if_fail (format != NULL); - if (!g_settings_is_writable (plugin->priv->settings, + if (!g_settings_is_writable (settings, CUSTOM_FORMAT_KEY)) return; - g_settings_set_string (plugin->priv->settings, + g_settings_set_string (settings, CUSTOM_FORMAT_KEY, format); } @@ -448,13 +456,24 @@ get_time (const gchar* format) } static void -dialog_disposed (GObject *obj, gpointer dialog_pointer) +configure_dialog_destroyed (GtkWidget *widget, + gpointer data) { + TimeConfigureDialog *dialog = (TimeConfigureDialog *) data; + pluma_debug (DEBUG_PLUGINS); - g_free (dialog_pointer); + g_object_unref (dialog->settings); + g_slice_free (TimeConfigureDialog, data); +} - pluma_debug_message (DEBUG_PLUGINS, "END"); +static void +choose_format_dialog_destroyed (GtkWidget *widget, + gpointer data) +{ + pluma_debug (DEBUG_PLUGINS); + + g_slice_free (ChooseFormatDialog, data); } static GtkTreeModel * @@ -640,6 +659,7 @@ configure_dialog_button_toggled (GtkToggleButton *button, TimeConfigureDialog *d gtk_widget_set_sensitive (dialog->custom_entry, TRUE); gtk_widget_set_sensitive (dialog->custom_format_example, TRUE); + set_prompt_type (dialog->settings, USE_CUSTOM_FORMAT); return; } @@ -649,6 +669,7 @@ configure_dialog_button_toggled (GtkToggleButton *button, TimeConfigureDialog *d gtk_widget_set_sensitive (dialog->custom_entry, FALSE); gtk_widget_set_sensitive (dialog->custom_format_example, FALSE); + set_prompt_type (dialog->settings, USE_SELECTED_FORMAT); return; } @@ -658,6 +679,7 @@ configure_dialog_button_toggled (GtkToggleButton *button, TimeConfigureDialog *d gtk_widget_set_sensitive (dialog->custom_entry, FALSE); gtk_widget_set_sensitive (dialog->custom_format_example, FALSE); + set_prompt_type (dialog->settings, PROMPT_SELECTED_FORMAT); return; } } @@ -691,13 +713,23 @@ get_format_from_list (GtkWidget *listview) g_return_val_if_reached (0); } +static void +configure_dialog_selection_changed (GtkTreeSelection *selection, + TimeConfigureDialog *dialog) +{ + gint sel_format; + + sel_format = get_format_from_list (dialog->list); + set_selected_format (dialog->settings, formats[sel_format]); +} + static TimeConfigureDialog * get_configure_dialog (PlumaTimePlugin *plugin) { TimeConfigureDialog *dialog = NULL; + GtkTreeSelection *selection; gchar *data_dir; gchar *ui_file; - GtkWidget *content; GtkWidget *viewport; PlumaTimePluginPromptType prompt_type; gchar *sf, *cf; @@ -710,37 +742,15 @@ get_configure_dialog (PlumaTimePlugin *plugin) pluma_debug (DEBUG_PLUGINS); - GtkWidget *dlg = gtk_dialog_new_with_buttons (_("Configure insert date/time plugin..."), - NULL, - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CANCEL, - GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, - GTK_RESPONSE_OK, - GTK_STOCK_HELP, - GTK_RESPONSE_HELP, - NULL); - - g_return_val_if_fail (dlg != NULL, NULL); + dialog = g_slice_new (TimeConfigureDialog); + dialog->settings = g_object_ref (plugin->priv->settings); - dialog = g_new0 (TimeConfigureDialog, 1); - dialog->dialog = dlg; - - /* HIG defaults */ - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog->dialog)), 5); - gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog->dialog))), - 2); /* 2 * 5 + 2 = 12 */ - gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dialog->dialog))), - 5); - gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog->dialog))), 6); - - - data_dir = pluma_plugin_get_data_dir (PLUMA_PLUGIN (plugin)); + data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (plugin)); ui_file = g_build_filename (data_dir, "pluma-time-setup-dialog.ui", NULL); ret = pluma_utils_get_ui_objects (ui_file, root_objects, &error_widget, - "time_dialog_content", &content, + "time_dialog_content", &dialog->content, "formats_viewport", &viewport, "formats_tree", &dialog->list, "always_prompt", &dialog->prompt, @@ -755,27 +765,20 @@ get_configure_dialog (PlumaTimePlugin *plugin) if (!ret) { - gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog->dialog))), - error_widget, - TRUE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (error_widget), 5); - - gtk_widget_show (error_widget); - - return dialog; + return NULL; } - gtk_window_set_resizable (GTK_WINDOW (dialog->dialog), FALSE); - sf = get_selected_format (plugin); create_formats_list (dialog->list, sf, plugin); g_free (sf); prompt_type = get_prompt_type (plugin); - cf = get_custom_format (plugin); - gtk_entry_set_text (GTK_ENTRY(dialog->custom_entry), cf); - g_free (cf); + g_settings_bind (dialog->settings, + CUSTOM_FORMAT_KEY, + dialog->custom_entry, + "text", + G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); if (prompt_type == USE_CUSTOM_FORMAT) { @@ -808,14 +811,6 @@ get_configure_dialog (PlumaTimePlugin *plugin) /* setup a window of a sane size. */ gtk_widget_set_size_request (GTK_WIDGET (viewport), 10, 200); - gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog->dialog))), - content, FALSE, FALSE, 0); - g_object_unref (content); - gtk_container_set_border_width (GTK_CONTAINER (content), 5); - - gtk_dialog_set_default_response (GTK_DIALOG (dialog->dialog), - GTK_RESPONSE_OK); - g_signal_connect (dialog->custom, "toggled", G_CALLBACK (configure_dialog_button_toggled), @@ -828,15 +823,21 @@ get_configure_dialog (PlumaTimePlugin *plugin) "toggled", G_CALLBACK (configure_dialog_button_toggled), dialog); - g_signal_connect (dialog->dialog, - "dispose", - G_CALLBACK (dialog_disposed), + g_signal_connect (dialog->content, + "destroy", + G_CALLBACK (configure_dialog_destroyed), dialog); g_signal_connect (dialog->custom_entry, "changed", G_CALLBACK (updated_custom_format_example), dialog->custom_format_example); + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->list)); + g_signal_connect (selection, + "changed", + G_CALLBACK (configure_dialog_selection_changed), + dialog); + return dialog; } @@ -866,8 +867,8 @@ choose_format_dialog_row_activated (GtkTreeView *list, sel_format = get_format_from_list (dialog->list); the_time = get_time (formats[sel_format]); - set_prompt_type (dialog->plugin, PROMPT_SELECTED_FORMAT); - set_selected_format (dialog->plugin, formats[sel_format]); + set_prompt_type (dialog->settings, PROMPT_SELECTED_FORMAT); + set_selected_format (dialog->settings, formats[sel_format]); g_return_if_fail (the_time != NULL); @@ -892,9 +893,10 @@ get_choose_format_dialog (GtkWindow *parent, if (parent != NULL) wg = gtk_window_get_group (parent); - dialog = g_new0 (ChooseFormatDialog, 1); + dialog = g_slice_new (ChooseFormatDialog); + dialog->settings = plugin->priv->settings; - data_dir = pluma_plugin_get_data_dir (PLUMA_PLUGIN (plugin)); + data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (plugin)); ui_file = g_build_filename (data_dir, "pluma-time-dialog.ui", NULL); ret = pluma_utils_get_ui_objects (ui_file, NULL, @@ -991,8 +993,8 @@ get_choose_format_dialog (GtkWindow *parent, G_CALLBACK (choose_format_dialog_button_toggled), dialog); g_signal_connect (dialog->dialog, - "dispose", - G_CALLBACK (dialog_disposed), + "destroy", + G_CALLBACK (choose_format_dialog_destroyed), dialog); g_signal_connect (dialog->custom_entry, "changed", @@ -1037,8 +1039,8 @@ choose_format_dialog_response_cb (GtkWidget *widget, sel_format = get_format_from_list (dialog->list); the_time = get_time (formats[sel_format]); - set_prompt_type (dialog->plugin, PROMPT_SELECTED_FORMAT); - set_selected_format (dialog->plugin, formats[sel_format]); + set_prompt_type (dialog->settings, PROMPT_SELECTED_FORMAT); + set_selected_format (dialog->settings, formats[sel_format]); } else { @@ -1047,8 +1049,8 @@ choose_format_dialog_response_cb (GtkWidget *widget, format = gtk_entry_get_text (GTK_ENTRY (dialog->custom_entry)); the_time = get_time (format); - set_prompt_type (dialog->plugin, PROMPT_CUSTOM_FORMAT); - set_custom_format (dialog->plugin, format); + set_prompt_type (dialog->settings, PROMPT_CUSTOM_FORMAT); + set_custom_format (dialog->settings, format); } g_return_if_fail (the_time != NULL); @@ -1067,28 +1069,30 @@ choose_format_dialog_response_cb (GtkWidget *widget, static void time_cb (GtkAction *action, - ActionData *data) + PlumaTimePlugin *plugin) { + PlumaWindow *window; GtkTextBuffer *buffer; gchar *the_time = NULL; PlumaTimePluginPromptType prompt_type; pluma_debug (DEBUG_PLUGINS); - buffer = GTK_TEXT_BUFFER (pluma_window_get_active_document (data->window)); + window = PLUMA_WINDOW (plugin->priv->window); + buffer = GTK_TEXT_BUFFER (pluma_window_get_active_document (window)); g_return_if_fail (buffer != NULL); - prompt_type = get_prompt_type (data->plugin); + prompt_type = get_prompt_type (plugin); if (prompt_type == USE_CUSTOM_FORMAT) { - gchar *cf = get_custom_format (data->plugin); + gchar *cf = get_custom_format (plugin); the_time = get_time (cf); g_free (cf); } else if (prompt_type == USE_SELECTED_FORMAT) { - gchar *sf = get_selected_format (data->plugin); + gchar *sf = get_selected_format (plugin); the_time = get_time (sf); g_free (sf); } @@ -1096,13 +1100,13 @@ time_cb (GtkAction *action, { ChooseFormatDialog *dialog; - dialog = get_choose_format_dialog (GTK_WINDOW (data->window), + dialog = get_choose_format_dialog (GTK_WINDOW (window), prompt_type, - data->plugin); + plugin); if (dialog != NULL) { dialog->buffer = buffer; - dialog->plugin = data->plugin; + dialog->settings = plugin->priv->settings; g_signal_connect (dialog->dialog, "response", @@ -1122,100 +1126,101 @@ time_cb (GtkAction *action, g_free (the_time); } -static void -ok_button_pressed (TimeConfigureDialog *dialog) +static GtkWidget * +pluma_time_plugin_create_configure_widget (PeasGtkConfigurable *configurable) { - gint sel_format; - const gchar *custom_format; + TimeConfigureDialog *dialog; - pluma_debug (DEBUG_PLUGINS); + dialog = get_configure_dialog (PLUMA_TIME_PLUGIN (configurable)); - sel_format = get_format_from_list (dialog->list); + return dialog->content; +} - custom_format = gtk_entry_get_text (GTK_ENTRY (dialog->custom_entry)); +static void +pluma_time_plugin_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + PlumaTimePlugin *plugin = PLUMA_TIME_PLUGIN (object); - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->custom))) - { - set_prompt_type (dialog->plugin, USE_CUSTOM_FORMAT); - set_custom_format (dialog->plugin, custom_format); - } - else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->use_list))) + switch (prop_id) { - set_prompt_type (dialog->plugin, USE_SELECTED_FORMAT); - set_selected_format (dialog->plugin, formats [sel_format]); - } - else - { - /* Default to prompt the user with the list selected */ - set_prompt_type (dialog->plugin, PROMPT_SELECTED_FORMAT); - } + case PROP_OBJECT: + plugin->priv->window = GTK_WIDGET (g_value_dup_object (value)); + break; - pluma_debug_message (DEBUG_PLUGINS, "Sel: %d", sel_format); + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } } static void -configure_dialog_response_cb (GtkWidget *widget, - gint response, - TimeConfigureDialog *dialog) +pluma_time_plugin_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { - switch (response) - { - case GTK_RESPONSE_HELP: - { - pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_HELP"); + PlumaTimePlugin *plugin = PLUMA_TIME_PLUGIN (object); - pluma_help_display (GTK_WINDOW (widget), - NULL, - "pluma-insert-date-time-plugin#pluma-date-time-configure"); + switch (prop_id) + { + case PROP_OBJECT: + g_value_set_object (value, plugin->priv->window); break; - } - case GTK_RESPONSE_OK: - { - pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_OK"); - - ok_button_pressed (dialog); - gtk_widget_destroy (dialog->dialog); + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; - } - case GTK_RESPONSE_CANCEL: - { - pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_CANCEL"); - gtk_widget_destroy (dialog->dialog); - } } } -static GtkWidget * -impl_create_configure_dialog (PlumaPlugin *plugin) +static void +pluma_time_plugin_class_init (PlumaTimePluginClass *klass) { - TimeConfigureDialog *dialog; + GObjectClass *object_class = G_OBJECT_CLASS (klass); - dialog = get_configure_dialog (PLUMA_TIME_PLUGIN (plugin)); + object_class->finalize = pluma_time_plugin_finalize; + object_class->dispose = pluma_time_plugin_dispose; + object_class->set_property = pluma_time_plugin_set_property; + object_class->get_property = pluma_time_plugin_get_property; - dialog->plugin = PLUMA_TIME_PLUGIN (plugin); + g_object_class_override_property (object_class, PROP_OBJECT, "object"); - g_signal_connect (dialog->dialog, - "response", - G_CALLBACK (configure_dialog_response_cb), - dialog); + g_type_class_add_private (object_class, sizeof (PlumaTimePluginPrivate)); +} - return GTK_WIDGET (dialog->dialog); +static void +pluma_time_plugin_class_finalize (PlumaTimePluginClass *klass) +{ + /* dummy function - used by G_DEFINE_DYNAMIC_TYPE_EXTENDED */ } static void -pluma_time_plugin_class_init (PlumaTimePluginClass *klass) +peas_activatable_iface_init (PeasActivatableInterface *iface) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - PlumaPluginClass *plugin_class = PLUMA_PLUGIN_CLASS (klass); + iface->activate = pluma_time_plugin_activate; + iface->deactivate = pluma_time_plugin_deactivate; + iface->update_state = pluma_time_plugin_update_state; +} - object_class->finalize = pluma_time_plugin_finalize; +static void +peas_gtk_configurable_iface_init (PeasGtkConfigurableInterface *iface) +{ + iface->create_configure_widget = pluma_time_plugin_create_configure_widget; +} - plugin_class->activate = impl_activate; - plugin_class->deactivate = impl_deactivate; - plugin_class->update_ui = impl_update_ui; +G_MODULE_EXPORT void +peas_register_types (PeasObjectModule *module) +{ + pluma_time_plugin_register_type (G_TYPE_MODULE (module)); - plugin_class->create_configure_dialog = impl_create_configure_dialog; + peas_object_module_register_extension_type (module, + PEAS_TYPE_ACTIVATABLE, + PLUMA_TYPE_TIME_PLUGIN); - g_type_class_add_private (object_class, sizeof (PlumaTimePluginPrivate)); + peas_object_module_register_extension_type (module, + PEAS_GTK_TYPE_CONFIGURABLE, + PLUMA_TYPE_TIME_PLUGIN); } |