plugins: Add GTK3 support

This commit is contained in:
Stefano Karapetsas 2013-10-30 16:20:47 +01:00
parent 7f0ccea481
commit e79794e482
8 changed files with 69 additions and 1 deletions

View File

@ -72,7 +72,11 @@ static void docinfo_dialog_response_cb (GtkDialog *widget,
PlumaWindow *window); PlumaWindow *window);
static void static void
#if GTK_CHECK_VERSION (3, 0, 0)
docinfo_dialog_dispose_cb (GObject *obj,
#else
docinfo_dialog_destroy_cb (GtkObject *obj, docinfo_dialog_destroy_cb (GtkObject *obj,
#endif
WindowData *data) WindowData *data)
{ {
pluma_debug (DEBUG_PLUGINS); pluma_debug (DEBUG_PLUGINS);
@ -142,8 +146,13 @@ get_docinfo_dialog (PlumaWindow *window,
GTK_WINDOW (window)); GTK_WINDOW (window));
g_signal_connect (dialog->dialog, g_signal_connect (dialog->dialog,
#if GTK_CHECK_VERSION (3, 0, 0)
"dispose",
G_CALLBACK (docinfo_dialog_dispose_cb),
#else
"destroy", "destroy",
G_CALLBACK (docinfo_dialog_destroy_cb), G_CALLBACK (docinfo_dialog_destroy_cb),
#endif
data); data);
g_signal_connect (dialog->dialog, g_signal_connect (dialog->dialog,
"response", "response",

View File

@ -169,8 +169,12 @@ pluma_file_browser_utils_confirmation_dialog (PlumaWindow * window,
/* Add a cancel button */ /* Add a cancel button */
button = gtk_button_new_from_stock (GTK_STOCK_CANCEL); button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
gtk_widget_show (button); 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); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
#endif
gtk_dialog_add_action_widget (GTK_DIALOG (dlg), gtk_dialog_add_action_widget (GTK_DIALOG (dlg),
button, button,
GTK_RESPONSE_CANCEL); GTK_RESPONSE_CANCEL);
@ -184,7 +188,11 @@ pluma_file_browser_utils_confirmation_dialog (PlumaWindow * window,
} }
gtk_widget_show (button); 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); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
#endif
gtk_dialog_add_action_widget (GTK_DIALOG (dlg), gtk_dialog_add_action_widget (GTK_DIALOG (dlg),
button, button,
GTK_RESPONSE_OK); GTK_RESPONSE_OK);

View File

@ -22,7 +22,11 @@
#include <string.h> #include <string.h>
#include <gio/gio.h> #include <gio/gio.h>
#include <pluma/pluma-plugin.h> #include <pluma/pluma-plugin.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>
#if GTK_CHECK_VERSION (3, 0, 0)
#include <gdk/gdkkeysyms-compat.h>
#endif
#include "pluma-file-browser-store.h" #include "pluma-file-browser-store.h"
#include "pluma-file-bookmarks-store.h" #include "pluma-file-bookmarks-store.h"

View File

@ -28,7 +28,11 @@
#include <string.h> #include <string.h>
#include <glib.h> #include <glib.h>
#include <glib/gi18n-lib.h> #include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>
#if GTK_CHECK_VERSION (3, 0, 0)
#include <gdk/gdkkeysyms-compat.h>
#endif
#include <pluma/pluma-utils.h> #include <pluma/pluma-utils.h>
#include <pluma/pluma-plugin.h> #include <pluma/pluma-plugin.h>

View File

@ -92,7 +92,11 @@ static const GtkActionEntry action_entries[] =
}; };
static void static void
#if GTK_CHECK_VERSION (3, 0, 0)
sort_dialog_dispose (GObject *obj,
#else
sort_dialog_destroy (GtkObject *obj, sort_dialog_destroy (GtkObject *obj,
#endif
gpointer dialog_pointer) gpointer dialog_pointer)
{ {
pluma_debug (DEBUG_PLUGINS); pluma_debug (DEBUG_PLUGINS);
@ -194,8 +198,13 @@ get_sort_dialog (ActionData *action_data)
GTK_RESPONSE_OK); GTK_RESPONSE_OK);
g_signal_connect (dialog->dialog, g_signal_connect (dialog->dialog,
#if GTK_CHECK_VERSION (3, 0, 0)
"dispose",
G_CALLBACK (sort_dialog_dispose),
#else
"destroy", "destroy",
G_CALLBACK (sort_dialog_destroy), G_CALLBACK (sort_dialog_destroy),
#endif
dialog); dialog);
g_signal_connect (dialog->dialog, g_signal_connect (dialog->dialog,

View File

@ -109,7 +109,11 @@ static guint signals [LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE(PlumaSpellCheckerDialog, pluma_spell_checker_dialog, GTK_TYPE_WINDOW) G_DEFINE_TYPE(PlumaSpellCheckerDialog, pluma_spell_checker_dialog, GTK_TYPE_WINDOW)
static void static void
#if GTK_CHECK_VERSION (3, 0,0)
pluma_spell_checker_dialog_dispose (GObject *object)
#else
pluma_spell_checker_dialog_destroy (GtkObject *object) pluma_spell_checker_dialog_destroy (GtkObject *object)
#endif
{ {
PlumaSpellCheckerDialog *dlg = PLUMA_SPELL_CHECKER_DIALOG (object); PlumaSpellCheckerDialog *dlg = PLUMA_SPELL_CHECKER_DIALOG (object);
@ -125,7 +129,11 @@ pluma_spell_checker_dialog_destroy (GtkObject *object)
dlg->misspelled_word = NULL; 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); GTK_OBJECT_CLASS (pluma_spell_checker_dialog_parent_class)->destroy (object);
#endif
} }
static void static void
@ -135,7 +143,11 @@ pluma_spell_checker_dialog_class_init (PlumaSpellCheckerDialogClass * klass)
object_class = G_OBJECT_CLASS (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; GTK_OBJECT_CLASS (object_class)->destroy = pluma_spell_checker_dialog_destroy;
#endif
signals[IGNORE] = signals[IGNORE] =
g_signal_new ("ignore", g_signal_new ("ignore",
@ -291,7 +303,11 @@ create_dialog (PlumaSpellCheckerDialog *dlg,
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
/* Set default button */ /* 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); GTK_WIDGET_SET_FLAGS (dlg->change_button, GTK_CAN_DEFAULT);
#endif
gtk_widget_grab_default (dlg->change_button); gtk_widget_grab_default (dlg->change_button);
gtk_entry_set_activates_default (GTK_ENTRY (dlg->word_entry), TRUE); gtk_entry_set_activates_default (GTK_ENTRY (dlg->word_entry), TRUE);

View File

@ -41,7 +41,11 @@
#include <pluma/pluma-debug.h> #include <pluma/pluma-debug.h>
#include <pluma/pluma-plugin.h> #include <pluma/pluma-plugin.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>
#if GTK_CHECK_VERSION (3, 0, 0)
#include <gdk/gdkkeysyms-compat.h>
#endif
#include <glib/gi18n.h> #include <glib/gi18n.h>
#define PLUMA_TAGLIST_PLUGIN_PANEL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \ #define PLUMA_TAGLIST_PLUGIN_PANEL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \

View File

@ -450,7 +450,11 @@ get_time (const gchar* format)
} }
static void static void
#if GTK_CHECK_VERSION (3, 0, 0)
dialog_disposed (GObject *obj, gpointer dialog_pointer)
#else
dialog_destroyed (GtkObject *obj, gpointer dialog_pointer) dialog_destroyed (GtkObject *obj, gpointer dialog_pointer)
#endif
{ {
pluma_debug (DEBUG_PLUGINS); pluma_debug (DEBUG_PLUGINS);
@ -830,8 +834,13 @@ get_configure_dialog (PlumaTimePlugin *plugin)
G_CALLBACK (configure_dialog_button_toggled), G_CALLBACK (configure_dialog_button_toggled),
dialog); dialog);
g_signal_connect (dialog->dialog, g_signal_connect (dialog->dialog,
#if GTK_CHECK_VERSION (3, 0, 0)
"dispose",
G_CALLBACK (dialog_disposed),
#else
"destroy", "destroy",
G_CALLBACK (dialog_destroyed), G_CALLBACK (dialog_destroyed),
#endif
dialog); dialog);
g_signal_connect (dialog->custom_entry, g_signal_connect (dialog->custom_entry,
"changed", "changed",
@ -993,8 +1002,13 @@ get_choose_format_dialog (GtkWindow *parent,
G_CALLBACK (choose_format_dialog_button_toggled), G_CALLBACK (choose_format_dialog_button_toggled),
dialog); dialog);
g_signal_connect (dialog->dialog, g_signal_connect (dialog->dialog,
#if GTK_CHECK_VERSION (3, 0, 0)
"dispose",
G_CALLBACK (dialog_disposed),
#else
"destroy", "destroy",
G_CALLBACK (dialog_destroyed), G_CALLBACK (dialog_destroyed),
#endif
dialog); dialog);
g_signal_connect (dialog->custom_entry, g_signal_connect (dialog->custom_entry,
"changed", "changed",