From e79794e482337c26cdeb3daff28c12ea8fb2f5d8 Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Wed, 30 Oct 2013 16:20:47 +0100 Subject: plugins: Add GTK3 support --- plugins/docinfo/pluma-docinfo-plugin.c | 9 +++++++++ plugins/filebrowser/pluma-file-browser-utils.c | 10 +++++++++- plugins/filebrowser/pluma-file-browser-view.c | 4 ++++ plugins/filebrowser/pluma-file-browser-widget.c | 4 ++++ plugins/sort/pluma-sort-plugin.c | 9 +++++++++ plugins/spell/pluma-spell-checker-dialog.c | 16 ++++++++++++++++ plugins/taglist/pluma-taglist-plugin-panel.c | 4 ++++ plugins/time/pluma-time-plugin.c | 14 ++++++++++++++ 8 files changed, 69 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/docinfo/pluma-docinfo-plugin.c b/plugins/docinfo/pluma-docinfo-plugin.c index 454a7c6a..1cfe0238 100755 --- a/plugins/docinfo/pluma-docinfo-plugin.c +++ b/plugins/docinfo/pluma-docinfo-plugin.c @@ -72,7 +72,11 @@ static void docinfo_dialog_response_cb (GtkDialog *widget, PlumaWindow *window); static void +#if GTK_CHECK_VERSION (3, 0, 0) +docinfo_dialog_dispose_cb (GObject *obj, +#else docinfo_dialog_destroy_cb (GtkObject *obj, +#endif WindowData *data) { pluma_debug (DEBUG_PLUGINS); @@ -142,8 +146,13 @@ get_docinfo_dialog (PlumaWindow *window, GTK_WINDOW (window)); g_signal_connect (dialog->dialog, +#if GTK_CHECK_VERSION (3, 0, 0) + "dispose", + G_CALLBACK (docinfo_dialog_dispose_cb), +#else "destroy", G_CALLBACK (docinfo_dialog_destroy_cb), +#endif data); g_signal_connect (dialog->dialog, "response", diff --git a/plugins/filebrowser/pluma-file-browser-utils.c b/plugins/filebrowser/pluma-file-browser-utils.c index b8274907..86c64053 100644 --- a/plugins/filebrowser/pluma-file-browser-utils.c +++ b/plugins/filebrowser/pluma-file-browser-utils.c @@ -169,8 +169,12 @@ pluma_file_browser_utils_confirmation_dialog (PlumaWindow * window, /* Add a cancel button */ button = gtk_button_new_from_stock (GTK_STOCK_CANCEL); gtk_widget_show (button); - + +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_can_default (button, TRUE); +#else GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); +#endif gtk_dialog_add_action_widget (GTK_DIALOG (dlg), button, GTK_RESPONSE_CANCEL); @@ -184,7 +188,11 @@ pluma_file_browser_utils_confirmation_dialog (PlumaWindow * window, } gtk_widget_show (button); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_can_default (button, TRUE); +#else GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); +#endif gtk_dialog_add_action_widget (GTK_DIALOG (dlg), button, GTK_RESPONSE_OK); diff --git a/plugins/filebrowser/pluma-file-browser-view.c b/plugins/filebrowser/pluma-file-browser-view.c index e2488415..eaad61fc 100644 --- a/plugins/filebrowser/pluma-file-browser-view.c +++ b/plugins/filebrowser/pluma-file-browser-view.c @@ -22,7 +22,11 @@ #include #include #include +#include #include +#if GTK_CHECK_VERSION (3, 0, 0) +#include +#endif #include "pluma-file-browser-store.h" #include "pluma-file-bookmarks-store.h" diff --git a/plugins/filebrowser/pluma-file-browser-widget.c b/plugins/filebrowser/pluma-file-browser-widget.c index 22c3c3b0..8e9a0a84 100644 --- a/plugins/filebrowser/pluma-file-browser-widget.c +++ b/plugins/filebrowser/pluma-file-browser-widget.c @@ -28,7 +28,11 @@ #include #include #include +#include #include +#if GTK_CHECK_VERSION (3, 0, 0) +#include +#endif #include #include diff --git a/plugins/sort/pluma-sort-plugin.c b/plugins/sort/pluma-sort-plugin.c index 83ffc18b..c4389ec0 100755 --- a/plugins/sort/pluma-sort-plugin.c +++ b/plugins/sort/pluma-sort-plugin.c @@ -92,7 +92,11 @@ static const GtkActionEntry action_entries[] = }; static void +#if GTK_CHECK_VERSION (3, 0, 0) +sort_dialog_dispose (GObject *obj, +#else sort_dialog_destroy (GtkObject *obj, +#endif gpointer dialog_pointer) { pluma_debug (DEBUG_PLUGINS); @@ -194,8 +198,13 @@ get_sort_dialog (ActionData *action_data) GTK_RESPONSE_OK); g_signal_connect (dialog->dialog, +#if GTK_CHECK_VERSION (3, 0, 0) + "dispose", + G_CALLBACK (sort_dialog_dispose), +#else "destroy", G_CALLBACK (sort_dialog_destroy), +#endif dialog); g_signal_connect (dialog->dialog, diff --git a/plugins/spell/pluma-spell-checker-dialog.c b/plugins/spell/pluma-spell-checker-dialog.c index c2c4e275..5a253252 100755 --- a/plugins/spell/pluma-spell-checker-dialog.c +++ b/plugins/spell/pluma-spell-checker-dialog.c @@ -109,7 +109,11 @@ static guint signals [LAST_SIGNAL] = { 0 }; G_DEFINE_TYPE(PlumaSpellCheckerDialog, pluma_spell_checker_dialog, GTK_TYPE_WINDOW) static void +#if GTK_CHECK_VERSION (3, 0,0) +pluma_spell_checker_dialog_dispose (GObject *object) +#else pluma_spell_checker_dialog_destroy (GtkObject *object) +#endif { PlumaSpellCheckerDialog *dlg = PLUMA_SPELL_CHECKER_DIALOG (object); @@ -125,7 +129,11 @@ pluma_spell_checker_dialog_destroy (GtkObject *object) dlg->misspelled_word = NULL; } +#if GTK_CHECK_VERSION (3, 0,0) + G_OBJECT_CLASS (pluma_spell_checker_dialog_parent_class)->dispose (object); +#else GTK_OBJECT_CLASS (pluma_spell_checker_dialog_parent_class)->destroy (object); +#endif } static void @@ -135,7 +143,11 @@ pluma_spell_checker_dialog_class_init (PlumaSpellCheckerDialogClass * klass) object_class = G_OBJECT_CLASS (klass); +#if GTK_CHECK_VERSION (3, 0, 0) + object_class->dispose = pluma_spell_checker_dialog_dispose; +#else GTK_OBJECT_CLASS (object_class)->destroy = pluma_spell_checker_dialog_destroy; +#endif signals[IGNORE] = g_signal_new ("ignore", @@ -291,7 +303,11 @@ create_dialog (PlumaSpellCheckerDialog *dlg, gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); /* Set default button */ +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_set_can_default (dlg->change_button, TRUE); +#else GTK_WIDGET_SET_FLAGS (dlg->change_button, GTK_CAN_DEFAULT); +#endif gtk_widget_grab_default (dlg->change_button); gtk_entry_set_activates_default (GTK_ENTRY (dlg->word_entry), TRUE); diff --git a/plugins/taglist/pluma-taglist-plugin-panel.c b/plugins/taglist/pluma-taglist-plugin-panel.c index 367b8f04..4ed043da 100755 --- a/plugins/taglist/pluma-taglist-plugin-panel.c +++ b/plugins/taglist/pluma-taglist-plugin-panel.c @@ -41,7 +41,11 @@ #include #include +#include #include +#if GTK_CHECK_VERSION (3, 0, 0) +#include +#endif #include #define PLUMA_TAGLIST_PLUGIN_PANEL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \ diff --git a/plugins/time/pluma-time-plugin.c b/plugins/time/pluma-time-plugin.c index 36a96352..a1b8e354 100755 --- a/plugins/time/pluma-time-plugin.c +++ b/plugins/time/pluma-time-plugin.c @@ -450,7 +450,11 @@ get_time (const gchar* format) } static void +#if GTK_CHECK_VERSION (3, 0, 0) +dialog_disposed (GObject *obj, gpointer dialog_pointer) +#else dialog_destroyed (GtkObject *obj, gpointer dialog_pointer) +#endif { pluma_debug (DEBUG_PLUGINS); @@ -830,8 +834,13 @@ get_configure_dialog (PlumaTimePlugin *plugin) G_CALLBACK (configure_dialog_button_toggled), dialog); g_signal_connect (dialog->dialog, +#if GTK_CHECK_VERSION (3, 0, 0) + "dispose", + G_CALLBACK (dialog_disposed), +#else "destroy", G_CALLBACK (dialog_destroyed), +#endif dialog); g_signal_connect (dialog->custom_entry, "changed", @@ -993,8 +1002,13 @@ get_choose_format_dialog (GtkWindow *parent, G_CALLBACK (choose_format_dialog_button_toggled), dialog); g_signal_connect (dialog->dialog, +#if GTK_CHECK_VERSION (3, 0, 0) + "dispose", + G_CALLBACK (dialog_disposed), +#else "destroy", G_CALLBACK (dialog_destroyed), +#endif dialog); g_signal_connect (dialog->custom_entry, "changed", -- cgit v1.2.1