diff --git a/README b/README index 208fbf6..733b335 100644 --- a/README +++ b/README @@ -22,7 +22,7 @@ How to compile and install clipit ------------------------------------------------------------------------------- Requirements: - * gtk+ >= 2.10.0 + * gtk+ >= 2.10.0 (>= 3.0 for gtk+3) * xdotool - for automatic paste functionality Download the clipit source code, then: diff --git a/configure.in b/configure.in index d244e7c..f72ad78 100644 --- a/configure.in +++ b/configure.in @@ -88,7 +88,14 @@ AC_PROG_MAKE_SET() # ------------------------------------------------------------------------------- # Checks for libraries. # ------------------------------------------------------------------------------- -AM_PATH_GTK_2_0(2.10.0, [], AC_MSG_ERROR(Requirement not met: gtk >= 2.10.0)) +AC_ARG_WITH([gtk3], AS_HELP_STRING([--with-gtk3], [Build with the GTK+ 3 interface])) + +if test "x$with_gtk3" = "xyes"; then + PKG_CHECK_MODULES([GTK], [gtk+-3.0]) +else + PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.10]) +fi + AM_PATH_GLIB_2_0(2.14.0, [], AC_MSG_ERROR(Requirement not met: glib >= 2.14.0)) # ------------------------------------------------------------------------------- diff --git a/src/Makefile.am b/src/Makefile.am index e9ac4ff..36933a0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ AM_CPPFLAGS = -I$(top_srcdir) AM_CFLAGS = -Wall -g -DCLIPITLOCALEDIR=\""$(clipitlocaledir)"\" ## FIXME!!! -INCLUDES = $(GTK_CFLAGS) $(APPINDICATOR_CFLAGS) -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include +INCLUDES = $(GTK_CFLAGS) $(APPINDICATOR_CFLAGS) LDADD = $(GTK_LIBS) $(APPINDICATOR_LIBS) $(X11_LIBS) AM_LDFLAGS = -Wl,--as-needed diff --git a/src/eggaccelerators.c b/src/eggaccelerators.c index 466ca5a..92ab7ac 100644 --- a/src/eggaccelerators.c +++ b/src/eggaccelerators.c @@ -579,20 +579,20 @@ reload_modmap (GdkKeymap *keymap, j = 0; while (j < n_entries) { - if (keyvals[j] == GDK_Num_Lock) + if (keyvals[j] == GDK_KEY_Num_Lock) mask |= EGG_VIRTUAL_NUM_LOCK_MASK; - else if (keyvals[j] == GDK_Scroll_Lock) + else if (keyvals[j] == GDK_KEY_Scroll_Lock) mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK; - else if (keyvals[j] == GDK_Meta_L || - keyvals[j] == GDK_Meta_R) + else if (keyvals[j] == GDK_KEY_Meta_L || + keyvals[j] == GDK_KEY_Meta_R) mask |= EGG_VIRTUAL_META_MASK; - else if (keyvals[j] == GDK_Hyper_L || - keyvals[j] == GDK_Hyper_R) + else if (keyvals[j] == GDK_KEY_Hyper_L || + keyvals[j] == GDK_KEY_Hyper_R) mask |= EGG_VIRTUAL_HYPER_MASK; - else if (keyvals[j] == GDK_Super_L || - keyvals[j] == GDK_Super_R) + else if (keyvals[j] == GDK_KEY_Super_L || + keyvals[j] == GDK_KEY_Super_R) mask |= EGG_VIRTUAL_SUPER_MASK; - else if (keyvals[j] == GDK_Mode_switch) + else if (keyvals[j] == GDK_KEY_Mode_switch) mask |= EGG_VIRTUAL_MODE_SWITCH_MASK; ++j; diff --git a/src/eggaccelerators.h b/src/eggaccelerators.h index 8dee284..adfbcfb 100644 --- a/src/eggaccelerators.h +++ b/src/eggaccelerators.h @@ -21,7 +21,7 @@ #ifndef __EGG_ACCELERATORS_H__ #define __EGG_ACCELERATORS_H__ -#include +#include #include G_BEGIN_DECLS diff --git a/src/keybinder.c b/src/keybinder.c index ef58a85..6862c69 100644 --- a/src/keybinder.c +++ b/src/keybinder.c @@ -86,7 +86,7 @@ grab_ungrab_with_ignorable_modifiers (GdkWindow *rootwin, XGrabKey (GDK_WINDOW_XDISPLAY (rootwin), binding->keycode, binding->modifiers | mod_masks [i], - GDK_WINDOW_XWINDOW (rootwin), + GDK_WINDOW_XID (rootwin), False, GrabModeAsync, GrabModeAsync); @@ -94,7 +94,7 @@ grab_ungrab_with_ignorable_modifiers (GdkWindow *rootwin, XUngrabKey (GDK_WINDOW_XDISPLAY (rootwin), binding->keycode, binding->modifiers | mod_masks [i], - GDK_WINDOW_XWINDOW (rootwin)); + GDK_WINDOW_XID (rootwin)); } } } @@ -309,7 +309,8 @@ keybinder_is_modifier (guint keycode) XModifierKeymap *mod_keymap; gboolean retval = FALSE; - mod_keymap = XGetModifierMapping (gdk_display); + mod_keymap = XGetModifierMapping ( + GDK_WINDOW_XDISPLAY(gdk_display_get_default())); map_size = 8 * mod_keymap->max_keypermod; diff --git a/src/main.c b/src/main.c index 830b45e..60a4496 100644 --- a/src/main.c +++ b/src/main.c @@ -279,7 +279,7 @@ static void show_about_dialog(GtkMenuItem *menu_item, gpointer user_data) { gtk_window_set_icon((GtkWindow*)about_dialog, gtk_widget_render_icon(about_dialog, GTK_STOCK_ABOUT, GTK_ICON_SIZE_MENU, NULL)); - gtk_about_dialog_set_name((GtkAboutDialog*)about_dialog, "ClipIt"); + gtk_about_dialog_set_program_name((GtkAboutDialog*)about_dialog, "ClipIt"); #ifdef HAVE_CONFIG_H gtk_about_dialog_set_version((GtkAboutDialog*)about_dialog, VERSION); #endif @@ -831,7 +831,7 @@ static void clipit_init() { create_app_indicator(1); #else status_icon = gtk_status_icon_new_from_icon_name("clipit-trayicon"); - gtk_status_icon_set_tooltip((GtkStatusIcon*)status_icon, _("Clipboard Manager")); + gtk_status_icon_set_tooltip_text((GtkStatusIcon*)status_icon, _("Clipboard Manager")); g_signal_connect((GObject*)status_icon, "button_press_event", (GCallback)status_icon_clicked, NULL); #endif } diff --git a/src/main.h b/src/main.h index 13b4ce3..37537b9 100644 --- a/src/main.h +++ b/src/main.h @@ -31,6 +31,10 @@ G_BEGIN_DECLS #define POPUP_DELAY 30 #define CHECK_INTERVAL 500 +#if GTK_MAJOR_VERSION == 3 +#define GTK_DIALOG_NO_SEPARATOR 0 +#endif + typedef struct { gboolean use_copy; /* Use copy */ gboolean use_primary; /* Use primary */ diff --git a/src/manage.c b/src/manage.c index 07eacb7..5dddb73 100644 --- a/src/manage.c +++ b/src/manage.c @@ -150,14 +150,14 @@ static void edit_selected() gtk_scrolled_window_set_policy((GtkScrolledWindow*)scrolled_window, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), scrolled_window, TRUE, TRUE, 2); + gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), scrolled_window, TRUE, TRUE, 2); GtkWidget* text_view = gtk_text_view_new_with_buffer(clipboard_buffer); gtk_text_view_set_left_margin((GtkTextView*)text_view, 2); gtk_text_view_set_right_margin((GtkTextView*)text_view, 2); gtk_container_add((GtkContainer*)scrolled_window, text_view); GtkWidget *static_check = gtk_check_button_new_with_mnemonic(_("_Static item")); gtk_toggle_button_set_active((GtkToggleButton*)static_check, elem_data->is_static); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), static_check, FALSE, FALSE, 2); + gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), static_check, FALSE, FALSE, 2); /* Run the dialog */ gtk_widget_show_all(dialog); diff --git a/src/preferences.c b/src/preferences.c index 1f20998..dec9b60 100644 --- a/src/preferences.c +++ b/src/preferences.c @@ -641,7 +641,7 @@ void show_preferences(gint tab) { *alignment, *hbox, *vbox; - GtkObject *adjustment, *adjustment_small, *adjustment_statics; + GtkWidget *adjustment, *adjustment_small, *adjustment_statics; GtkTreeViewColumn *tree_column; /* Create the dialog */ @@ -799,10 +799,10 @@ void show_preferences(gint tab) { label = gtk_label_new(_("Omit items in the:")); gtk_misc_set_alignment((GtkMisc*)label, 0.0, 0.50); gtk_box_pack_start((GtkBox*)hbox, label, FALSE, FALSE, 0); - ellipsize_combo = gtk_combo_box_new_text(); - gtk_combo_box_append_text((GtkComboBox*)ellipsize_combo, _("Beginning")); - gtk_combo_box_append_text((GtkComboBox*)ellipsize_combo, _("Middle")); - gtk_combo_box_append_text((GtkComboBox*)ellipsize_combo, _("End")); + ellipsize_combo = gtk_combo_box_text_new(); + gtk_combo_box_text_append_text((GtkComboBox*)ellipsize_combo, _("Beginning")); + gtk_combo_box_text_append_text((GtkComboBox*)ellipsize_combo, _("Middle")); + gtk_combo_box_text_append_text((GtkComboBox*)ellipsize_combo, _("End")); gtk_box_pack_start((GtkBox*)hbox, ellipsize_combo, FALSE, FALSE, 0); gtk_box_pack_start((GtkBox*)vbox_history, frame, FALSE, FALSE, 0); @@ -823,9 +823,9 @@ void show_preferences(gint tab) { gtk_misc_set_alignment((GtkMisc*)label, 0.0, 0.50); gtk_box_pack_start((GtkBox*)hbox, label, FALSE, FALSE, 0); ellipsize_combo = gtk_combo_box_new_text(); - gtk_combo_box_append_text((GtkComboBox*)ellipsize_combo, _("Beginning")); - gtk_combo_box_append_text((GtkComboBox*)ellipsize_combo, _("Middle")); - gtk_combo_box_append_text((GtkComboBox*)ellipsize_combo, _("End")); + gtk_combo_box_text_append_text((GtkComboBox*)ellipsize_combo, _("Beginning")); + gtk_combo_box_text_append_text((GtkComboBox*)ellipsize_combo, _("Middle")); + gtk_combo_box_text_append_text((GtkComboBox*)ellipsize_combo, _("End")); gtk_box_pack_start((GtkBox*)hbox, ellipsize_combo, FALSE, FALSE, 0); gtk_box_pack_start((GtkBox*)vbox_history, frame, FALSE, FALSE, 0); */