summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/find-dialog.glade1
-rw-r--r--src/profile-editor.c27
-rw-r--r--src/profile-new-dialog.glade1
-rw-r--r--src/profile-preferences.glade1
-rw-r--r--src/terminal-accels.c6
-rw-r--r--src/terminal-app.c3
-rw-r--r--src/terminal-screen.c5
-rw-r--r--src/terminal-util.c26
-rw-r--r--src/terminal-window.c94
9 files changed, 130 insertions, 34 deletions
diff --git a/src/find-dialog.glade b/src/find-dialog.glade
index 71f8b78..0ee75b0 100644
--- a/src/find-dialog.glade
+++ b/src/find-dialog.glade
@@ -2,7 +2,6 @@
<!DOCTYPE glade-interface SYSTEM "http://glade.mate.org/glade-2.0.dtd">
<glade-interface>
-<requires lib="mate"/>
<widget class="GtkDialog" id="find-dialog">
<property name="border_width">5</property>
diff --git a/src/profile-editor.c b/src/profile-editor.c
index 4cf2af6..f3eb4e1 100644
--- a/src/profile-editor.c
+++ b/src/profile-editor.c
@@ -522,6 +522,31 @@ reset_compat_defaults_cb (GtkWidget *button,
static void
init_color_scheme_menu (GtkWidget *combo_box)
{
+ #if GTK_CHECK_VERSION(3, 0, 0)
+
+ GtkCellRenderer *renderer;
+ GtkTreeIter iter;
+ GtkListStore *store;
+ int i;
+
+ store = gtk_list_store_new (1, G_TYPE_STRING);
+ for (i = 0; i < G_N_ELEMENTS (color_schemes); ++i)
+ gtk_list_store_insert_with_values (store, &iter, -1,
+ 0, _(color_schemes[i].name),
+ -1);
+ gtk_list_store_insert_with_values (store, &iter, -1,
+ 0, _("Custom"),
+ -1);
+
+ gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (store));
+ g_object_unref (store);
+
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, TRUE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer, "text", 0, NULL);
+
+ #else
+
int i;
i = G_N_ELEMENTS (color_schemes);
@@ -530,6 +555,8 @@ init_color_scheme_menu (GtkWidget *combo_box)
gtk_combo_box_prepend_text (GTK_COMBO_BOX (combo_box),
_(color_schemes[--i].name));
}
+
+ #endif
}
static char*
diff --git a/src/profile-new-dialog.glade b/src/profile-new-dialog.glade
index 1a22599..04b4fc7 100644
--- a/src/profile-new-dialog.glade
+++ b/src/profile-new-dialog.glade
@@ -2,7 +2,6 @@
<!DOCTYPE glade-interface SYSTEM "http://glade.mate.org/glade-2.0.dtd">
<glade-interface>
-<requires lib="mate"/>
<widget class="GtkDialog" id="new-profile-dialog">
<property name="border_width">5</property>
diff --git a/src/profile-preferences.glade b/src/profile-preferences.glade
index 09be1bc..7003a26 100644
--- a/src/profile-preferences.glade
+++ b/src/profile-preferences.glade
@@ -2,7 +2,6 @@
<!DOCTYPE glade-interface SYSTEM "http://glade.mate.org/glade-2.0.dtd">
<glade-interface>
-<requires lib="mate"/>
<widget class="GtkDialog" id="profile-editor-dialog">
<property name="border_width">5</property>
diff --git a/src/terminal-accels.c b/src/terminal-accels.c
index 4516be6..9dad3fc 100644
--- a/src/terminal-accels.c
+++ b/src/terminal-accels.c
@@ -29,6 +29,10 @@
#include "terminal-profile.h"
#include "terminal-util.h"
+#if GTK_CHECK_VERSION(3, 0, 0)
+ #include <gdk/gdkkeysyms-compat.h>
+#endif
+
/* NOTES
*
* There are two sources of keybindings changes, from GSettings and from
@@ -826,7 +830,7 @@ accel_edited_callback (GtkCellRendererAccel *cell,
GTK_BUTTONS_OK,
_("The shortcut key ā€œ%sā€ is already bound to the ā€œ%sā€ action"),
name,
-
+
other_key->user_visible_name ? _(other_key->user_visible_name) : other_key->gsettings_key);
g_free (name);
diff --git a/src/terminal-app.c b/src/terminal-app.c
index baac703..91b3d02 100644
--- a/src/terminal-app.c
+++ b/src/terminal-app.c
@@ -950,6 +950,9 @@ terminal_app_system_font_notify_cb (GSettings *settings,
font = DEFAULT_MONOSPACE_FONT;
g_assert (font != NULL);
+ if (font && (strlen (font) == 0)) /* empty string */
+ font = DEFAULT_MONOSPACE_FONT;
+
font_desc = pango_font_description_from_string (font);
if (app->system_font_desc &&
pango_font_description_equal (app->system_font_desc, font_desc))
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index d64f876..562d793 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -44,6 +44,11 @@
#include "eggshell.h"
+#if GTK_CHECK_VERSION(3, 0, 0)
+ #include <gdk/gdkkeysyms-compat.h>
+ #define GDK_WINDOW_XWINDOW GDK_WINDOW_XID
+#endif
+
#define URL_MATCH_CURSOR (GDK_HAND2)
#define SKEY_MATCH_CURSOR (GDK_HAND2)
diff --git a/src/terminal-util.c b/src/terminal-util.c
index 0384366..0ffb8b8 100644
--- a/src/terminal-util.c
+++ b/src/terminal-util.c
@@ -44,6 +44,11 @@
#include "terminal-util.h"
#include "terminal-window.h"
+#if GTK_CHECK_VERSION(3, 0, 0)
+ #define GDK_WINDOW_XWINDOW GDK_WINDOW_XID
+ #define GDK_DRAWABLE_XID GDK_WINDOW_XID
+#endif
+
void
terminal_util_set_unique_role (GtkWindow *window, const char *prefix)
{
@@ -178,11 +183,11 @@ terminal_util_show_help (const char *topic,
if (topic)
{
- url = g_strdup_printf ("ghelp://%s?%s", uri, topic);
+ url = g_strdup_printf ("help://%s?%s", uri, topic);
}
else
{
- url = g_strdup_printf ("ghelp://%s", uri);
+ url = g_strdup_printf ("help://%s", uri);
}
if (!open_url (GTK_WINDOW (parent), url, gtk_get_current_event_time (), &error))
@@ -1049,7 +1054,11 @@ gboolean
terminal_util_x11_get_net_wm_desktop (GdkWindow *window,
guint32 *desktop)
{
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ GdkDisplay *display = gdk_window_get_display (window);
+ #else
GdkDisplay *display = gdk_drawable_get_display (window);
+ #endif
Atom type;
int format;
guchar *data;
@@ -1092,7 +1101,11 @@ terminal_util_x11_set_net_wm_desktop (GdkWindow *window,
* http://bugzilla.mate.org/show_bug.cgi?id=586311 asks for GTK+
* to just handle everything behind the scenes including the desktop.
*/
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ GdkScreen *screen = gdk_window_get_screen (window);
+ #else
GdkScreen *screen = gdk_drawable_get_screen (window);
+ #endif
GdkDisplay *display = gdk_screen_get_display (screen);
Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
char *wm_selection_name;
@@ -1158,7 +1171,12 @@ terminal_util_x11_set_net_wm_desktop (GdkWindow *window,
void
terminal_util_x11_clear_demands_attention (GdkWindow *window)
{
+
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ GdkScreen *screen = gdk_window_get_screen (window);
+ #else
GdkScreen *screen = gdk_drawable_get_screen (window);
+ #endif
GdkDisplay *display = gdk_screen_get_display (screen);
XClientMessageEvent xclient;
@@ -1195,7 +1213,11 @@ terminal_util_x11_clear_demands_attention (GdkWindow *window)
gboolean
terminal_util_x11_window_is_minimized (GdkWindow *window)
{
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ GdkDisplay *display = gdk_window_get_display (window);
+ #else
GdkDisplay *display = gdk_drawable_get_display (window);
+ #endif
Atom type;
gint format;
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 0d04f11..69b953c 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -43,6 +43,11 @@
#include "skey-popup.h"
#endif
+#if GTK_CHECK_VERSION(3, 0, 0)
+ #include <gdk/gdk.h>
+ #include <gdk/gdkkeysyms-compat.h>
+#endif
+
struct _TerminalWindowPrivate
{
GtkActionGroup *action_group;
@@ -1035,10 +1040,8 @@ update_edit_menu_cb (GtkClipboard *clipboard,
}
static void
-edit_menu_activate_callback (GtkMenuItem *menuitem,
- gpointer user_data)
+update_edit_menu(TerminalWindow *window)
{
- TerminalWindow *window = (TerminalWindow *) user_data;
GtkClipboard *clipboard;
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
@@ -1522,23 +1525,43 @@ terminal_window_realize (GtkWidget *widget)
TerminalWindowPrivate *priv = window->priv;
#ifdef GDK_WINDOWING_X11
GdkScreen *screen;
- GdkColormap *colormap;
GtkAllocation widget_allocation;
-
+ #if GTK_CHECK_VERSION (3, 0, 0)
+ GdkVisual *visual;
+ #else
+ GdkColormap *colormap;
+ #endif
gtk_widget_get_allocation (widget, &widget_allocation);
screen = gtk_widget_get_screen (GTK_WIDGET (window));
- if (gdk_screen_is_composited (screen) &&
- (colormap = gdk_screen_get_rgba_colormap (screen)) != NULL)
- {
- /* Set RGBA colormap if possible so VTE can use real transparency */
- gtk_widget_set_colormap (widget, colormap);
- priv->have_argb_visual = TRUE;
- }
- else
- {
- gtk_widget_set_colormap (widget, gdk_screen_get_default_colormap (screen));
- priv->have_argb_visual = FALSE;
- }
+
+ #if GTK_CHECK_VERSION (3, 0, 0)
+ if (gdk_screen_is_composited (screen) &&
+ (visual = gdk_screen_get_rgba_visual (screen)) != NULL)
+ {
+ /* Set RGBA visual if possible so VTE can use real transparency */
+ gtk_widget_set_visual (GTK_WIDGET (widget), visual);
+ priv->have_argb_visual = TRUE;
+ }
+ else
+ {
+ gtk_widget_set_visual (GTK_WIDGET (window), gdk_screen_get_system_visual (screen));
+ priv->have_argb_visual = FALSE;
+ }
+ #else
+ if (gdk_screen_is_composited (screen) &&
+ (colormap = gdk_screen_get_rgba_colormap (screen)) != NULL)
+ {
+ /* Set RGBA colormap if possible so VTE can use real transparency */
+ gtk_widget_set_colormap (widget, colormap);
+ priv->have_argb_visual = TRUE;
+ }
+ else
+ {
+ gtk_widget_set_colormap (widget, gdk_screen_get_default_colormap (screen));
+ priv->have_argb_visual = FALSE;
+ }
+ #endif
+
#endif
_terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
@@ -2099,6 +2122,7 @@ terminal_window_init (TerminalWindow *window)
GError *error;
GtkWindowGroup *window_group;
GtkAccelGroup *accel_group;
+ GtkClipboard *clipboard;
priv = window->priv = G_TYPE_INSTANCE_GET_PRIVATE (window, TERMINAL_TYPE_WINDOW, TerminalWindowPrivate);
@@ -2126,7 +2150,11 @@ terminal_window_init (TerminalWindow *window)
gtk_notebook_set_scrollable (GTK_NOTEBOOK (priv->notebook), TRUE);
gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
- gtk_notebook_set_group (GTK_NOTEBOOK (priv->notebook), GUINT_TO_POINTER (1));
+ #if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_notebook_set_group_name (GTK_NOTEBOOK (priv->notebook), I_("mate-terminal-window"));
+ #else
+ gtk_notebook_set_group (GTK_NOTEBOOK (priv->notebook), GUINT_TO_POINTER (1));
+ #endif
gtk_notebook_set_scrollable (GTK_NOTEBOOK (priv->notebook),
TRUE);
g_signal_connect (priv->notebook, "button-press-event",
@@ -2143,6 +2171,11 @@ terminal_window_init (TerminalWindow *window)
G_CALLBACK (terminal_window_update_tabs_menu_sensitivity),
window, NULL, G_CONNECT_SWAPPED | G_CONNECT_AFTER);
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ g_signal_connect (priv->notebook, "create-window",
+ G_CALLBACK (handle_tab_droped_on_desktop), window);
+ #endif
+
gtk_box_pack_end (GTK_BOX (main_vbox), priv->notebook, TRUE, TRUE, 0);
gtk_widget_show (priv->notebook);
@@ -2172,16 +2205,10 @@ terminal_window_init (TerminalWindow *window)
gtk_ui_manager_insert_action_group (manager, action_group, 0);
g_object_unref (action_group);
- action = gtk_action_group_get_action (action_group, "Edit");
- g_signal_connect (action, "activate",
- G_CALLBACK (edit_menu_activate_callback), window);
-
- /* Set this action invisible so the Edit menu doesn't flash the first
- * time it's shown and there's no text/uri-list on the clipboard.
- */
- action = gtk_action_group_get_action (priv->action_group, "EditPasteURIPaths");
- gtk_action_set_visible (action, FALSE);
-
+ clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
+ g_signal_connect_swapped (clipboard, "owner-change",
+ G_CALLBACK (update_edit_menu), window);
+ update_edit_menu (window);
/* Idem for this action, since the window is not fullscreen. */
action = gtk_action_group_get_action (priv->action_group, "PopupLeaveFullscreen");
gtk_action_set_visible (action, FALSE);
@@ -2262,7 +2289,9 @@ terminal_window_class_init (TerminalWindowClass *klass)
"}\n"
"widget \"*.mate-terminal-tab-close-button\" style \"mate-terminal-tab-close-button-style\"");
+ #if !GTK_CHECK_VERSION(3, 0, 0)
gtk_notebook_set_window_creation_hook (handle_tab_droped_on_desktop, NULL, NULL);
+ #endif
}
static void
@@ -2272,6 +2301,7 @@ terminal_window_dispose (GObject *object)
TerminalWindowPrivate *priv = window->priv;
TerminalApp *app;
GdkScreen *screen;
+ GtkClipboard *clipboard;
remove_popup_info (window);
@@ -2295,6 +2325,10 @@ terminal_window_dispose (GObject *object)
g_signal_handlers_disconnect_by_func (app,
G_CALLBACK (terminal_window_encoding_list_changed_cb),
window);
+ clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
+ g_signal_handlers_disconnect_by_func (clipboard,
+ G_CALLBACK (update_edit_menu),
+ window);
screen = gtk_widget_get_screen (GTK_WIDGET (object));
if (screen)
@@ -3980,7 +4014,11 @@ tabs_next_or_previous_tab_cb (GtkAction *action,
gtk_binding_set_activate (gtk_binding_set_by_class (klass),
keyval,
GDK_CONTROL_MASK,
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ G_OBJECT (priv->notebook));
+ #else
GTK_OBJECT (priv->notebook));
+ #endif
}
static void