[Xfce4-commits] <thunar-vcs-plugin:master> Moved dialog button box functions to dialog common

Peter de Ridder noreply at xfce.org
Sun Feb 27 20:38:10 CET 2011


Updating branch refs/heads/master
         to faed686f60fdd32f9ca540c94b75122bfa9b1dc9 (commit)
       from 6a4e78abe3d71ffdabd04eef574f695a8dea84c6 (commit)

commit faed686f60fdd32f9ca540c94b75122bfa9b1dc9
Author: Peter de Ridder <peter at xfce.org>
Date:   Sun Feb 27 15:24:01 2011 +0100

    Moved dialog button box functions to dialog common

 tvp-git-helper/tgh-dialog-common.c |   48 ++++++++++++++++++++++++++++++++++++
 tvp-git-helper/tgh-dialog-common.h |    4 +++
 tvp-git-helper/tgh-stash-dialog.c  |   45 ++-------------------------------
 3 files changed, 55 insertions(+), 42 deletions(-)

diff --git a/tvp-git-helper/tgh-dialog-common.c b/tvp-git-helper/tgh-dialog-common.c
index 3f028b8..1eb7f19 100644
--- a/tvp-git-helper/tgh-dialog-common.c
+++ b/tvp-git-helper/tgh-dialog-common.c
@@ -48,3 +48,51 @@ close_response (GtkDialog *dialog, gint response, gpointer user_data)
   gtk_widget_destroy (GTK_WIDGET (dialog));
 }
 
+void
+tgh_dialog_replace_action_area (GtkDialog *dialog)
+{
+  GtkWidget *box;
+
+  gtk_container_remove (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), GTK_DIALOG (dialog)->action_area);
+
+  GTK_DIALOG (dialog)->action_area = box = gtk_hbox_new (FALSE, 0);
+
+  gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->vbox), box,
+      FALSE, TRUE, 0);
+  gtk_widget_show (box);
+
+  gtk_box_reorder_child (GTK_BOX (GTK_DIALOG (dialog)->vbox), box, 0);
+}
+
+void
+tgh_make_homogeneous (GtkWidget *first, ...)
+{
+  GtkWidget *iter;
+  GtkRequisition request;
+  gint max_width = 0;
+  gint max_height = 0;
+  va_list ap;
+
+  va_start (ap, first);
+  iter = first;
+  while (iter)
+  {
+    gtk_widget_size_request(iter, &request);
+    if (request.width > max_width)
+      max_width = request.width;
+    if (request.height > max_height)
+      max_height = request.height;
+    iter = va_arg (ap, GtkWidget *);
+  }
+  va_end (ap);
+
+  va_start (ap, first);
+  iter = first;
+  while (iter)
+  {
+    gtk_widget_set_size_request (iter, max_width, max_height);
+    iter = va_arg (ap, GtkWidget *);
+  }
+  va_end (ap);
+}
+
diff --git a/tvp-git-helper/tgh-dialog-common.h b/tvp-git-helper/tgh-dialog-common.h
index a5ed666..650d3f5 100644
--- a/tvp-git-helper/tgh-dialog-common.h
+++ b/tvp-git-helper/tgh-dialog-common.h
@@ -21,6 +21,10 @@ G_BEGIN_DECLS
 
 void tgh_dialog_start (GtkDialog*, gboolean);
 
+void tgh_dialog_replace_action_area (GtkDialog *);
+
+void tgh_make_homogeneous (GtkWidget *, ...) G_GNUC_NULL_TERMINATED;
+
 G_END_DECLS
 
 #endif /*__TGH_DIALOG_COMMON_H__*/
diff --git a/tvp-git-helper/tgh-stash-dialog.c b/tvp-git-helper/tgh-stash-dialog.c
index d62048f..192458c 100644
--- a/tvp-git-helper/tgh-stash-dialog.c
+++ b/tvp-git-helper/tgh-stash-dialog.c
@@ -25,6 +25,7 @@
 #include <gtk/gtk.h>
 
 #include "tgh-common.h"
+#include "tgh-dialog-common.h"
 #include "tgh-stash-dialog.h"
 
 static void selection_changed (GtkTreeView*, gpointer);
@@ -34,7 +35,6 @@ static void apply_clicked (GtkButton*, gpointer);
 static void pop_clicked (GtkButton*, gpointer);
 static void drop_clicked (GtkButton*, gpointer);
 static void clear_clicked (GtkButton*, gpointer);
-static void tgh_make_homogeneous (GtkWidget *, ...) G_GNUC_NULL_TERMINATED;
 
 struct _TghStashDialog
 {
@@ -221,15 +221,8 @@ tgh_stash_dialog_init (TghStashDialog *dialog)
   gtk_widget_show (vpane);
 
   //gtk_button_box_set_layout(GTK_BUTTON_BOX (GTK_DIALOG (dialog)->action_area), GTK_BUTTONBOX_EDGE);
-  gtk_container_remove (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), GTK_DIALOG (dialog)->action_area);
-
-  GTK_DIALOG (dialog)->action_area = box = gtk_hbox_new (FALSE, 0);
-
-  gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->vbox), box,
-      FALSE, TRUE, 0);
-  gtk_widget_show (box);
-
-  gtk_box_reorder_child (GTK_BOX (GTK_DIALOG (dialog)->vbox), box, 0);
+  tgh_dialog_replace_action_area (GTK_DIALOG (dialog));
+  box = GTK_DIALOG (dialog)->action_area;
 
   //box = gtk_hbox_new (FALSE, 12);
 
@@ -299,38 +292,6 @@ tgh_stash_dialog_new (const gchar *title, GtkWindow *parent, GtkDialogFlags flag
   return GTK_WIDGET(dialog);
 }
 
-static void
-tgh_make_homogeneous (GtkWidget *first, ...)
-{
-  GtkWidget *iter;
-  GtkRequisition request;
-  gint max_width = 0;
-  gint max_height = 0;
-  va_list ap;
-
-  va_start (ap, first);
-  iter = first;
-  while (iter)
-  {
-    gtk_widget_size_request(iter, &request);
-    if (request.width > max_width)
-      max_width = request.width;
-    if (request.height > max_height)
-      max_height = request.height;
-    iter = va_arg (ap, GtkWidget *);
-  }
-  va_end (ap);
-
-  va_start (ap, first);
-  iter = first;
-  while (iter)
-  {
-    gtk_widget_set_size_request (iter, max_width, max_height);
-    iter = va_arg (ap, GtkWidget *);
-  }
-  va_end (ap);
-}
-
 void       
 tgh_stash_dialog_add (TghStashDialog *dialog, const gchar *name, const gchar *branch, const gchar *description)
 {



More information about the Xfce4-commits mailing list