emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111380: Check for deprecated gtk_han


From: Jan D.
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111380: Check for deprecated gtk_handle_box in configure.
Date: Sun, 30 Dec 2012 19:44:00 +0100
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111380
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Sun 2012-12-30 19:44:00 +0100
message:
  Check for deprecated gtk_handle_box in configure.
  
  * configure.ac: Check for GtkHandlebox.
  
  * src/gtkutil.c (TOOLBAR_TOP_WIDGET): New macro.
  (xg_pack_tool_bar): Use TOOLBAR_TOP_WIDGET, condition out use of
  handlebox_widget.  Set toolbar_in_hbox to false/true, set
  toolbar_is_packed to true.
  (xg_update_tool_bar_sizes): Use widget returned by TOOLBAR_TOP_WIDGET.
  (update_frame_tool_bar): Check toolbar_is_packed for packing.
  Show all on TOOLBAR_TOP_WIDGET.
  (free_frame_tool_bar): Check toolbar_is_packed.  Use widget returned
  by TOOLBAR_TOP_WIDGET.
  (xg_change_toolbar_position): Use widget returned by TOOLBAR_TOP_WIDGET.
  Check toolbar_is_packed.
  
  * src/xterm.h (struct x_output): Surround handlebox_widget with
  #ifdef HAVE_GTK_HANDLE_BOX_NEW.  toolbar_is_packed is new,
  toolbar_in_hbox is bool.
modified:
  ChangeLog
  configure.ac
  src/ChangeLog
  src/gtkutil.c
  src/xterm.h
=== modified file 'ChangeLog'
--- a/ChangeLog 2012-12-30 18:09:01 +0000
+++ b/ChangeLog 2012-12-30 18:44:00 +0000
@@ -1,3 +1,7 @@
+2012-12-30  Jan Djärv  <address@hidden>
+
+       * configure.ac: Check for GtkHandlebox.
+
 2012-12-30  Andreas Schwab  <address@hidden>
 
        * configure.ac (TEMACS_LDFLAGS2): Don't define.

=== modified file 'configure.ac'
--- a/configure.ac      2012-12-30 18:09:01 +0000
+++ b/configure.ac      2012-12-30 18:44:00 +0000
@@ -2071,6 +2071,14 @@
     AC_CHECK_FUNCS(gtk_file_selection_new)
   fi
 
+  dnl Same as above for gtk_handle_box.
+  HAVE_GTK_HANDLE_BOX=no
+  AC_CHECK_DECL(GTK_TYPE_HANDLE_BOX, HAVE_GTK_HANDLE_BOX=yes,
+                   HAVE_GTK_HANDLE_BOX=no, [AC_INCLUDES_DEFAULT
+#include <gtk/gtk.h>])
+  if test "$HAVE_GTK_HANDLE_BOX" = yes; then
+    AC_CHECK_FUNCS(gtk_handle_box_new)
+  fi
 
   dnl Check for functions introduced in 2.14 and later.
   AC_CHECK_FUNCS(gtk_widget_get_window gtk_widget_set_has_window \

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-12-30 18:09:01 +0000
+++ b/src/ChangeLog     2012-12-30 18:44:00 +0000
@@ -1,3 +1,21 @@
+2012-12-30  Jan Djärv  <address@hidden>
+
+       * gtkutil.c (TOOLBAR_TOP_WIDGET): New macro.
+       (xg_pack_tool_bar): Use TOOLBAR_TOP_WIDGET, condition out use of
+       handlebox_widget.  Set toolbar_in_hbox to false/true, set
+       toolbar_is_packed to true.
+       (xg_update_tool_bar_sizes): Use widget returned by TOOLBAR_TOP_WIDGET.
+       (update_frame_tool_bar): Check toolbar_is_packed for packing.
+       Show all on TOOLBAR_TOP_WIDGET.
+       (free_frame_tool_bar): Check toolbar_is_packed.  Use widget returned
+       by TOOLBAR_TOP_WIDGET.
+       (xg_change_toolbar_position): Use widget returned by TOOLBAR_TOP_WIDGET.
+       Check toolbar_is_packed.
+
+       * xterm.h (struct x_output): Surround handlebox_widget with
+       #ifdef HAVE_GTK_HANDLE_BOX_NEW.  toolbar_is_packed is new,
+       toolbar_in_hbox is bool.
+
 2012-12-30  Andreas Schwab  <address@hidden>
 
        * src/Makefile.in (TEMACS_LDFLAGS2): Remove.

=== modified file 'src/gtkutil.c'
--- a/src/gtkutil.c     2012-12-25 15:07:59 +0000
+++ b/src/gtkutil.c     2012-12-30 18:44:00 +0000
@@ -4269,6 +4269,12 @@
   gtk_toolbar_set_orientation (GTK_TOOLBAR (w), o)
 #endif
 
+#ifdef HAVE_GTK_HANDLE_BOX_NEW
+#define TOOLBAR_TOP_WIDGET(x) ((x)->handlebox_widget)
+#else
+#define TOOLBAR_TOP_WIDGET(x) ((x)->toolbar_widget)
+#endif
+
 /* Attach a tool bar to frame F.  */
 
 static void
@@ -4276,14 +4282,16 @@
 {
   struct x_output *x = f->output_data.x;
   bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright);
+  GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x);
 
   toolbar_set_orientation (x->toolbar_widget,
                            into_hbox
                            ? GTK_ORIENTATION_VERTICAL
                            : GTK_ORIENTATION_HORIZONTAL);
+#ifdef HAVE_GTK_HANDLE_BOX_NEW
   if (!x->handlebox_widget)
     {
-      x->handlebox_widget = gtk_handle_box_new ();
+      top_widget = x->handlebox_widget = gtk_handle_box_new ();
       g_signal_connect (G_OBJECT (x->handlebox_widget), "child-detached",
                         G_CALLBACK (xg_tool_bar_detach_callback), f);
       g_signal_connect (G_OBJECT (x->handlebox_widget), "child-attached",
@@ -4291,34 +4299,40 @@
       gtk_container_add (GTK_CONTAINER (x->handlebox_widget),
                          x->toolbar_widget);
     }
+#endif
 
   if (into_hbox)
     {
+#ifdef HAVE_GTK_HANDLE_BOX_NEW
       gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget),
                                           GTK_POS_TOP);
-      gtk_box_pack_start (GTK_BOX (x->hbox_widget), x->handlebox_widget,
+#endif
+      gtk_box_pack_start (GTK_BOX (x->hbox_widget), top_widget,
                           FALSE, FALSE, 0);
 
       if (EQ (pos, Qleft))
         gtk_box_reorder_child (GTK_BOX (x->hbox_widget),
-                               x->handlebox_widget,
+                               top_widget,
                                0);
-      x->toolbar_in_hbox = 1;
+      x->toolbar_in_hbox = true;
     }
   else
     {
       bool vbox_pos = x->menubar_widget != 0;
+#ifdef HAVE_GTK_HANDLE_BOX_NEW
       gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget),
                                           GTK_POS_LEFT);
-      gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget,
+#endif
+      gtk_box_pack_start (GTK_BOX (x->vbox_widget), top_widget,
                           FALSE, FALSE, 0);
 
       if (EQ (pos, Qtop))
         gtk_box_reorder_child (GTK_BOX (x->vbox_widget),
-                               x->handlebox_widget,
+                               top_widget,
                                vbox_pos);
-      x->toolbar_in_hbox = 0;
+      x->toolbar_in_hbox = false;
     }
+  x->toolbar_is_packed = true;
 }
 
 /* Create a tool bar for frame F.  */
@@ -4561,13 +4575,14 @@
   struct x_output *x = f->output_data.x;
   GtkRequisition req;
   int nl = 0, nr = 0, nt = 0, nb = 0;
+  GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x);
 
-  gtk_widget_get_preferred_size (GTK_WIDGET (x->handlebox_widget), NULL, &req);
+  gtk_widget_get_preferred_size (GTK_WIDGET (top_widget), NULL, &req);
   if (x->toolbar_in_hbox)
     {
       int pos;
       gtk_container_child_get (GTK_CONTAINER (x->hbox_widget),
-                               x->handlebox_widget,
+                               top_widget,
                                "position", &pos, NULL);
       if (pos == 0) nl = req.width;
       else nr = req.width;
@@ -4576,7 +4591,7 @@
     {
       int pos;
       gtk_container_child_get (GTK_CONTAINER (x->vbox_widget),
-                               x->handlebox_widget,
+                               top_widget,
                                "position", &pos, NULL);
       if (pos == 0 || (pos == 1 && x->menubar_widget)) nt = req.height;
       else nb = req.height;
@@ -4611,7 +4626,6 @@
   GtkToolbar *wtoolbar;
   GtkToolItem *ti;
   GtkTextDirection dir;
-  bool pack_tool_bar = x->handlebox_widget == NULL;
   Lisp_Object style;
   bool text_image, horiz;
   struct xg_frame_tb_info *tbinfo;
@@ -4865,9 +4879,9 @@
 
   if (f->n_tool_bar_items != 0)
     {
-      if (pack_tool_bar)
+      if (! x->toolbar_is_packed)
         xg_pack_tool_bar (f, f->tool_bar_position);
-      gtk_widget_show_all (GTK_WIDGET (x->handlebox_widget));
+      gtk_widget_show_all (TOOLBAR_TOP_WIDGET (x));
       if (xg_update_tool_bar_sizes (f))
         xg_height_or_width_changed (f);
     }
@@ -4886,24 +4900,26 @@
   if (x->toolbar_widget)
     {
       struct xg_frame_tb_info *tbinfo;
-      bool is_packed = x->handlebox_widget != 0;
+      GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x);
+
       block_input ();
       /* We may have created the toolbar_widget in xg_create_tool_bar, but
          not the x->handlebox_widget which is created in xg_pack_tool_bar.  */
-      if (is_packed)
+      if (x->toolbar_is_packed)
         {
           if (x->toolbar_in_hbox)
             gtk_container_remove (GTK_CONTAINER (x->hbox_widget),
-                                  x->handlebox_widget);
+                                  top_widget);
           else
             gtk_container_remove (GTK_CONTAINER (x->vbox_widget),
-                                  x->handlebox_widget);
+                                  top_widget);
         }
       else
         gtk_widget_destroy (x->toolbar_widget);
 
       x->toolbar_widget = 0;
-      x->handlebox_widget = 0;
+      TOOLBAR_TOP_WIDGET (x) = 0;
+      x->toolbar_is_packed = false;
       FRAME_TOOLBAR_TOP_HEIGHT (f) = FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = 0;
       FRAME_TOOLBAR_LEFT_WIDTH (f) = FRAME_TOOLBAR_RIGHT_WIDTH (f) = 0;
 
@@ -4927,20 +4943,25 @@
 xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos)
 {
   struct x_output *x = f->output_data.x;
+  GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x);
 
-  if (! x->toolbar_widget || ! x->handlebox_widget)
+  if (! x->toolbar_widget || ! top_widget)
     return;
 
   block_input ();
-  g_object_ref (x->handlebox_widget);
-  if (x->toolbar_in_hbox)
-    gtk_container_remove (GTK_CONTAINER (x->hbox_widget),
-                          x->handlebox_widget);
-  else
-    gtk_container_remove (GTK_CONTAINER (x->vbox_widget),
-                          x->handlebox_widget);
+  g_object_ref (top_widget);
+  if (x->toolbar_is_packed)
+    {
+      if (x->toolbar_in_hbox)
+        gtk_container_remove (GTK_CONTAINER (x->hbox_widget),
+                              top_widget);
+      else
+        gtk_container_remove (GTK_CONTAINER (x->vbox_widget),
+                              top_widget);
+    }
+
   xg_pack_tool_bar (f, pos);
-  g_object_unref (x->handlebox_widget);
+  g_object_unref (top_widget);
   if (xg_update_tool_bar_sizes (f))
     xg_height_or_width_changed (f);
 

=== modified file 'src/xterm.h'
--- a/src/xterm.h       2012-12-25 15:07:59 +0000
+++ b/src/xterm.h       2012-12-30 18:44:00 +0000
@@ -473,10 +473,13 @@
   GtkWidget *menubar_widget;
   /* The tool bar in this frame  */
   GtkWidget *toolbar_widget;
-  /* The handle box that makes the tool bar detachable.  */
+#ifdef HAVE_GTK_HANDLE_BOX_NEW
+/* The handle box that makes the tool bar detachable.  */
   GtkWidget *handlebox_widget;
+#endif
   /* Non-zero if tool bar is packed into the hbox widget (i.e. vertical).  */
-  int toolbar_in_hbox;
+  bool toolbar_in_hbox;
+  bool toolbar_is_packed;
 
   /* The last size hints set.  */
   GdkGeometry size_hints;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]