[Xfce4-commits] [apps/xfce4-terminal] 01/05: initial Gtk3 port by Steven Vanden Branden

noreply at xfce.org noreply at xfce.org
Wed Jun 1 00:37:34 CEST 2016


This is an automated email from the git hooks/post-receive script.

ochosi pushed a commit to branch master
in repository apps/xfce4-terminal.

commit 9818d42deea698ccf691cde7f4797774d5ff816f
Author: minus <minus at mnus.de>
Date:   Tue Mar 31 16:24:02 2015 +0200

    initial Gtk3 port by Steven Vanden Branden
    
    Signed-off-by: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
---
 configure.ac.in            |  8 +++----
 terminal/terminal-app.c    |  2 +-
 terminal/terminal-screen.c | 19 ++++++++-------
 terminal/terminal-widget.c | 48 ++++++++++++++++++-------------------
 terminal/terminal-window.c | 59 +++++++++++++++++++++++-----------------------
 5 files changed, 68 insertions(+), 68 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index 6193df8..68a1bec 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -9,8 +9,8 @@ dnl ***************************
 dnl *** Version information ***
 dnl ***************************
 m4_define([terminal_version_major], [0])
-m4_define([terminal_version_minor], [6])
-m4_define([terminal_version_micro], [3])
+m4_define([terminal_version_minor], [7])
+m4_define([terminal_version_micro], [0])
 m4_define([terminal_version_nano], [])
 m4_define([terminal_version_build], [@REVISION@])
 m4_define([terminal_version_tag], [git])
@@ -86,10 +86,10 @@ XDT_CHECK_LIBX11()
 dnl ***********************************
 dnl *** Check for required packages ***
 dnl ***********************************
-XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.24.0])
+XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [3.14.0])
 XDT_CHECK_PACKAGE([VTE], [vte], [0.28])
 XDT_CHECK_PACKAGE([GIO], [gio-2.0], [2.26.0])
-XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.10.0])
+XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.10.0])
 
 dnl ***********************************
 dnl *** Used to compress glade data ***
diff --git a/terminal/terminal-app.c b/terminal/terminal-app.c
index 66dcd64..6a551ae 100644
--- a/terminal/terminal-app.c
+++ b/terminal/terminal-app.c
@@ -272,7 +272,7 @@ terminal_app_accel_map_load (gpointer user_data)
       for (i = 1; i < 10; i++)
         {
           g_snprintf (name, sizeof (name), "<Actions>/terminal-window/goto-tab-%d", i);
-          gtk_accel_map_change_entry (name, GDK_0 + i, GDK_MOD1_MASK, FALSE);
+          gtk_accel_map_change_entry (name, GDK_KEY_0 + i, GDK_MOD1_MASK, FALSE);
         }
     }
 
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 8831573..510ad14 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -439,7 +439,7 @@ terminal_screen_realize (GtkWidget *widget)
   (*GTK_WIDGET_CLASS (terminal_screen_parent_class)->realize) (widget);
 
   /* make sure the TerminalWidget is realized as well */
-  if (!GTK_WIDGET_REALIZED (TERMINAL_SCREEN (widget)->terminal))
+  if (! gtk_widget_get_realized(TERMINAL_SCREEN (widget)->terminal))
     gtk_widget_realize (TERMINAL_SCREEN (widget)->terminal);
 
   /* connect to the "composited-changed" signal */
@@ -735,10 +735,10 @@ terminal_screen_get_child_environment (TerminalScreen *screen)
 
   /* determine the toplevel widget */
   toplevel = gtk_widget_get_toplevel (GTK_WIDGET (screen));
-  if (toplevel != NULL && GTK_WIDGET_REALIZED (toplevel))
+  if (toplevel != NULL &&  gtk_widget_get_realized(toplevel))
     {
 #ifdef GDK_WINDOWING_X11
-      result[n++] = g_strdup_printf ("WINDOWID=%ld", (glong) GDK_WINDOW_XWINDOW (toplevel->window));
+      //result[n++] = g_strdup_printf ("WINDOWID=%ld", (glong) GDK_DRAWABLE_XID (gtk_widget_get_window(toplevel)));
 #endif
 
       /* determine the DISPLAY value for the command */
@@ -1251,7 +1251,7 @@ terminal_screen_vte_resize_window (VteTerminal    *terminal,
   /* don't do anything if the window is already fullscreen/maximized */
   toplevel = gtk_widget_get_toplevel (GTK_WIDGET (screen));
   if (!gtk_widget_get_realized (toplevel)
-      || (gdk_window_get_state (toplevel->window)
+      || (gdk_window_get_state (gtk_widget_get_window(toplevel))
           & (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN)) != 0)
     return;
 
@@ -1331,7 +1331,7 @@ terminal_screen_vte_window_contents_changed (TerminalScreen *screen)
 
   /* leave if we should not start an update */
   if (screen->tab_label == NULL
-      || GTK_WIDGET_STATE (screen->tab_label) != GTK_STATE_ACTIVE
+      || gtk_widget_get_state (screen->tab_label) != GTK_STATE_ACTIVE
       || time (NULL) - screen->activity_resize_time <= 1)
     return;
 
@@ -1388,8 +1388,8 @@ terminal_screen_timer_background (gpointer user_data)
     {
       loader = terminal_image_loader_get ();
       image = terminal_image_loader_load (loader,
-                                          screen->terminal->allocation.width,
-                                          screen->terminal->allocation.height);
+										  gtk_widget_get_allocated_width (screen->terminal),
+										  gtk_widget_get_allocated_height (screen->terminal));
       vte_terminal_set_background_image (VTE_TERMINAL (screen->terminal), image);
       if (G_LIKELY (image != NULL))
         g_object_unref (G_OBJECT (image));
@@ -1776,7 +1776,7 @@ terminal_screen_force_resize_window (TerminalScreen *screen,
     height = 0;
   height += ypad + char_height * rows;
 
-  if (GTK_WIDGET_MAPPED (window))
+  if (gtk_widget_get_mapped (window))
     gtk_window_resize (window, width, height);
   else
     gtk_window_set_default_size (window, width, height);
@@ -2166,7 +2166,8 @@ terminal_screen_get_tab_label (TerminalScreen *screen)
   button = gtk_button_new ();
   gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
   gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
-  GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_DEFAULT | GTK_CAN_FOCUS);
+  gtk_widget_set_can_focus (button, FALSE);
+  gtk_widget_set_can_default (button, FALSE);
   gtk_widget_set_tooltip_text (button, _("Close this tab"));
   gtk_container_add (GTK_CONTAINER (align), button);
   g_signal_connect_swapped (G_OBJECT (button), "clicked",
diff --git a/terminal/terminal-widget.c b/terminal/terminal-widget.c
index 5a7d266..36e6de5 100644
--- a/terminal/terminal-widget.c
+++ b/terminal/terminal-widget.c
@@ -480,32 +480,32 @@ terminal_widget_drag_data_received (GtkWidget        *widget,
       break;
 
     case TARGET_TEXT_PLAIN:
-      if (selection_data->format != 8 || selection_data->length == 0)
+      if (gtk_selection_data_get_format(selection_data) != 8 || gtk_selection_data_get_length (selection_data) == 0)
         {
           g_printerr (_("Unable to drop selection of type text/plain to terminal: Wrong format (%d) or length (%d)\n"),
-                      selection_data->format, selection_data->length);
+                      gtk_selection_data_get_format(selection_data), gtk_selection_data_get_length (selection_data));
         }
       else
         {
           vte_terminal_feed_child (VTE_TERMINAL (widget),
-                                   (const gchar *) selection_data->data,
-                                   selection_data->length);
+                                   (const gchar *) gtk_selection_data_get_data (selection_data),
+                                   gtk_selection_data_get_length (selection_data));
         }
       break;
 
     case TARGET_MOZ_URL:
-      if (selection_data->format != 8
-          || selection_data->length == 0
-          || (selection_data->length % 2) != 0)
+      if (gtk_selection_data_get_format(selection_data) != 8
+          || gtk_selection_data_get_length (selection_data) == 0
+          || (gtk_selection_data_get_length (selection_data) % 2) != 0)
         {
           g_printerr (_("Unable to drop Mozilla URL on terminal: Wrong format (%d) or length (%d)\n"),
-                      selection_data->format, selection_data->length);
+                      gtk_selection_data_get_format(selection_data), gtk_selection_data_get_length (selection_data));
         }
       else
         {
           str = g_string_new (NULL);
-          ucs = (const guint16 *) selection_data->data;
-          for (n = 0; n < selection_data->length / 2 && ucs[n] != '\n'; ++n)
+          ucs = (const guint16 *) gtk_selection_data_get_data (selection_data);
+          for (n = 0; n < gtk_selection_data_get_length (selection_data) / 2 && ucs[n] != '\n'; ++n)
             g_string_append_unichar (str, (gunichar) ucs[n]);
           filename = g_filename_from_uri (str->str, NULL, NULL);
           if (filename != NULL)
@@ -522,15 +522,15 @@ terminal_widget_drag_data_received (GtkWidget        *widget,
       break;
 
     case TARGET_URI_LIST:
-      if (selection_data->format != 8 || selection_data->length == 0)
+      if (gtk_selection_data_get_format(selection_data) != 8 || gtk_selection_data_get_length (selection_data) == 0)
         {
           g_printerr (_("Unable to drop URI list on terminal: Wrong format (%d) or length (%d)\n"),
-                      selection_data->format, selection_data->length);
+                      gtk_selection_data_get_format(selection_data), gtk_selection_data_get_length (selection_data));
         }
       else
         {
           /* split the text/uri-list */
-          text = g_strndup ((const gchar *) selection_data->data, selection_data->length);
+          text = g_strndup ((const gchar *) gtk_selection_data_get_data (selection_data), gtk_selection_data_get_length (selection_data));
           uris = g_uri_list_extract_uris (text);
           g_free (text);
 
@@ -567,17 +567,17 @@ terminal_widget_drag_data_received (GtkWidget        *widget,
       break;
 
     case TARGET_APPLICATION_X_COLOR:
-      if (selection_data->format != 16 || selection_data->length != 8)
+      if (gtk_selection_data_get_format(selection_data) != 16 || gtk_selection_data_get_length (selection_data) != 8)
         {
           g_printerr (_("Received invalid color data: Wrong format (%d) or length (%d)\n"),
-                      selection_data->format, selection_data->length);
+                      gtk_selection_data_get_format(selection_data), gtk_selection_data_get_length (selection_data));
         }
       else
         {
           /* get the color from the selection data (ignoring the alpha setting) */
-          color.red = ((guint16 *) selection_data->data)[0];
-          color.green = ((guint16 *) selection_data->data)[1];
-          color.blue = ((guint16 *) selection_data->data)[2];
+          color.red = ((guint16 *) gtk_selection_data_get_data (selection_data))[0];
+          color.green = ((guint16 *) gtk_selection_data_get_data (selection_data))[1];
+          color.blue = ((guint16 *) gtk_selection_data_get_data (selection_data))[2];
 
           /* prepare the value */
           g_value_init (&value, GDK_TYPE_COLOR);
@@ -630,8 +630,8 @@ terminal_widget_key_press_event (GtkWidget    *widget,
                 NULL);
 
   /* popup context menu if "Menu" or "<Shift>F10" is pressed */
-  if (event->keyval == GDK_Menu ||
-      (!shortcuts_no_menukey && (event->state & GDK_SHIFT_MASK) != 0 && event->keyval == GDK_F10))
+  if (event->keyval == GDK_KEY_Menu ||
+      (!shortcuts_no_menukey && (event->state & GDK_SHIFT_MASK) != 0 && event->keyval == GDK_KEY_F10))
     {
       gtk_widget_get_pointer (widget, &x, &y);
       terminal_widget_context_menu (TERMINAL_WIDGET (widget), 0, event->time, x, y);
@@ -640,15 +640,15 @@ terminal_widget_key_press_event (GtkWidget    *widget,
   else if (G_LIKELY (scrolling_single_line))
     {
       /* scroll up one line with "<Shift>Up" */
-      if ((event->state & GDK_SHIFT_MASK) != 0 && (event->keyval == GDK_Up || event->keyval == GDK_KP_Up))
+      if ((event->state & GDK_SHIFT_MASK) != 0 && (event->keyval == GDK_KEY_Up || event->keyval == GDK_KEY_KP_Up))
         {
-          gtk_adjustment_set_value (adjustment, adjustment->value - 1);
+          gtk_adjustment_set_value (adjustment, gtk_adjustment_get_value(adjustment) - 1);
           return TRUE;
         }
       /* scroll down one line with "<Shift>Down" */
-      else if ((event->state & GDK_SHIFT_MASK) != 0 && (event->keyval == GDK_Down || event->keyval == GDK_KP_Down))
+      else if ((event->state & GDK_SHIFT_MASK) != 0 && (event->keyval == GDK_KEY_Down || event->keyval == GDK_KEY_KP_Down))
         {
-          value = MIN (adjustment->value + 1, adjustment->upper - adjustment->page_size);
+          value = MIN (gtk_adjustment_get_value(adjustment) + 1, gtk_adjustment_get_upper(adjustment) - gtk_adjustment_get_page_size(adjustment));
           gtk_adjustment_set_value (adjustment, value);
           return TRUE;
         }
diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c
index 8dd564d..fc5dca4 100644
--- a/terminal/terminal-window.c
+++ b/terminal/terminal-window.c
@@ -86,11 +86,9 @@ static gboolean        terminal_window_accel_activate                (GtkAccelGr
 static void            terminal_window_update_actions                (TerminalWindow         *window);
 static void            terminal_window_rebuild_tabs_menu             (TerminalWindow         *window);
 static void            terminal_window_notebook_page_switched        (GtkNotebook            *notebook,
-                                                                      GtkNotebookPage        *page,
                                                                       guint                   page_num,
                                                                       TerminalWindow         *window);
 static void            terminal_window_notebook_page_reordered       (GtkNotebook            *notebook,
-                                                                      GtkNotebookPage        *page,
                                                                       guint                   page_num,
                                                                       TerminalWindow         *window);
 static void            terminal_window_notebook_page_added           (GtkNotebook            *notebook,
@@ -290,15 +288,15 @@ terminal_window_init (TerminalWindow *window)
   GtkWidget      *vbox;
   gboolean        always_show_tabs;
   GdkScreen      *screen;
-  GdkColormap    *colormap;
+  GdkVisual    *visual;
 
   window->preferences = terminal_preferences_get ();
 
   /* try to set the rgba colormap so vte can use real transparency */
   screen = gtk_window_get_screen (GTK_WINDOW (window));
-  colormap = gdk_screen_get_rgba_colormap (screen);
-  if (colormap != NULL)
-    gtk_widget_set_colormap (GTK_WIDGET (window), colormap);
+  visual = gdk_screen_get_rgba_visual (screen);
+  if (visual != NULL)
+    gtk_widget_set_visual (GTK_WIDGET (window), visual);
 
   window->action_group = gtk_action_group_new ("terminal-window");
   gtk_action_group_set_translation_domain (window->action_group,
@@ -501,7 +499,7 @@ terminal_window_confirm_close (TerminalWindow *window)
 
   dialog = gtk_dialog_new_with_buttons (_("Warning"), GTK_WINDOW (window),
                                         GTK_DIALOG_DESTROY_WITH_PARENT
-                                        | GTK_DIALOG_NO_SEPARATOR
+                                        | 0
                                         | GTK_DIALOG_MODAL,
                                         NULL);
 
@@ -518,7 +516,6 @@ terminal_window_confirm_close (TerminalWindow *window)
 
   hbox = gtk_hbox_new (FALSE, 6);
   gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 0);
   gtk_widget_show (hbox);
 
   image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
@@ -784,7 +781,6 @@ terminal_window_rebuild_tabs_menu (TerminalWindow *window)
 
 static void
 terminal_window_notebook_page_switched (GtkNotebook     *notebook,
-                                        GtkNotebookPage *page,
                                         guint            page_num,
                                         TerminalWindow  *window)
 {
@@ -829,7 +825,6 @@ terminal_window_notebook_page_switched (GtkNotebook     *notebook,
 
 static void
 terminal_window_notebook_page_reordered (GtkNotebook     *notebook,
-                                         GtkNotebookPage *page,
                                          guint            page_num,
                                          TerminalWindow  *window)
 {
@@ -936,16 +931,25 @@ terminal_window_notebook_page_removed (GtkNotebook    *notebook,
     }
 }
 
+static gboolean
+terminal_window_notebook_event_in_allocation (gint event_x,
+											  gint event_y,
+											  GtkWidget *widget)
+{
+	cairo_rectangle_int_t *allocation;
+	gtk_widget_get_allocation (widget, allocation);
+
+	if (event_x >= allocation->x \
+		&& event_x <= allocation->x + allocation->width \
+		&& event_y >= allocation->y \
+		&& event_y <= allocation->y + allocation->height)
+		{
+			return TRUE;
+		}
+	else
+		return FALSE;
 
-
-#define EVENT_IN_ALLOCATION(event_x,event_y,widget) \
-  ((event_x) >= (widget)->allocation.x  \
-  && (event_x) <= (widget)->allocation.x + (widget)->allocation.width \
-  && (event_y) >= (widget)->allocation.y \
-  && (event_y) <= (widget)->allocation.y + (widget)->allocation.height)
-
-
-
+}
 static gboolean
 terminal_window_notebook_button_press_event (GtkNotebook    *notebook,
                                              GdkEventButton *event,
@@ -969,7 +973,7 @@ terminal_window_notebook_button_press_event (GtkNotebook    *notebook,
         {
           /* check if the user double-clicked on the label */
           label = gtk_notebook_get_tab_label (notebook, GTK_WIDGET (window->active));
-          if (EVENT_IN_ALLOCATION (x, y, label))
+          if (terminal_window_notebook_event_in_allocation (x, y, label))
             {
               terminal_window_action_set_title (NULL, window);
               return TRUE;
@@ -982,7 +986,7 @@ terminal_window_notebook_button_press_event (GtkNotebook    *notebook,
       while ((page = gtk_notebook_get_nth_page (notebook, page_num)) != NULL)
         {
           label = gtk_notebook_get_tab_label (notebook, page);
-          if (EVENT_IN_ALLOCATION (x, y, label))
+          if (terminal_window_notebook_event_in_allocation (x, y, label))
             break;
           page_num++;
         }
@@ -1048,6 +1052,7 @@ terminal_window_notebook_drag_data_received (GtkWidget        *widget,
   GtkWidget  *child, *label;
   gint        i, n_pages;
   gboolean    succeed = FALSE;
+  cairo_rectangle_int_t *allocation;
 
   terminal_return_if_fail (TERMINAL_IS_WINDOW (window));
   terminal_return_if_fail (TERMINAL_IS_SCREEN (widget));
@@ -1059,12 +1064,7 @@ terminal_window_notebook_drag_data_received (GtkWidget        *widget,
       notebook = gtk_drag_get_source_widget (context);
       terminal_return_if_fail (GTK_IS_NOTEBOOK (notebook));
 
-      /* get the dragged screen */
-      screen = (GtkWidget **) selection_data->data;
-      if (!TERMINAL_IS_SCREEN (*screen))
-        goto leave;
-
-      /* leave if we dropped in the same screen and there is only one
+      /* leave if there is only one
        * page in the notebook (window will close before we insert) */
       if (gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook)) < 2
           && *screen == widget)
@@ -1077,9 +1077,9 @@ terminal_window_notebook_drag_data_received (GtkWidget        *widget,
           /* get the child label */
           child = gtk_notebook_get_nth_page (GTK_NOTEBOOK (window->notebook), i);
           label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (window->notebook), child);
-
+		  gtk_widget_get_allocation (label, allocation);
           /* break if we have a matching drop position */
-          if (x < (label->allocation.x + label->allocation.width / 2))
+          if (x < (allocation->x + allocation->width / 2))
             break;
         }
 
@@ -1600,7 +1600,6 @@ terminal_window_action_set_title (GtkAction      *action,
 
       box = gtk_hbox_new (FALSE, 12);
       gtk_container_set_border_width (GTK_CONTAINER (box), 6);
-      gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), box, TRUE, TRUE, 0);
       gtk_widget_show (box);
 
       label = gtk_label_new_with_mnemonic (_("_Title:"));

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list