[gnome-commander] Move create_*_with_mnemonic() functions to libgcmd/libgcmd-widget-factory.cc



commit 6a1d3667f2991768267f434feaf9df4c9cbf6ff9
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Tue May 3 22:42:30 2011 +0200

    Move create_*_with_mnemonic() functions to libgcmd/libgcmd-widget-factory.cc

 libgcmd/libgcmd-widget-factory.cc |   40 ++++++++++++++++++++++++++++++
 libgcmd/libgcmd-widget-factory.h  |    6 ++++
 src/gnome-cmd-search-dialog.cc    |   49 -------------------------------------
 3 files changed, 46 insertions(+), 49 deletions(-)
---
diff --git a/libgcmd/libgcmd-widget-factory.cc b/libgcmd/libgcmd-widget-factory.cc
index 61680bb..be159c1 100644
--- a/libgcmd/libgcmd-widget-factory.cc
+++ b/libgcmd/libgcmd-widget-factory.cc
@@ -130,6 +130,22 @@ GtkWidget *create_label (GtkWidget *parent, const gchar *text)
 }
 
 
+GtkWidget *create_label_with_mnemonic (GtkWidget *parent, const gchar *text, GtkWidget *for_widget)
+{
+    GtkWidget *label = gtk_label_new_with_mnemonic (text);
+
+    if (for_widget)
+        gtk_label_set_mnemonic_widget (GTK_LABEL (label), for_widget);
+
+    g_object_ref (label);
+    g_object_set_data_full (G_OBJECT (parent), "label", label, g_object_unref);
+    gtk_widget_show (label);
+    gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+
+    return label;
+}
+
+
 GtkWidget *create_bold_label (GtkWidget *parent, const gchar *text)
 {
     GtkWidget *label = create_label (parent, text);
@@ -246,6 +262,18 @@ GtkWidget *create_check (GtkWidget *parent, const gchar *text, const gchar *name
 }
 
 
+GtkWidget *create_check_with_mnemonic (GtkWidget *parent, const gchar *text, const gchar *name)
+{
+    GtkWidget *btn = gtk_check_button_new_with_mnemonic (text);
+
+    g_object_ref (btn);
+    g_object_set_data_full (G_OBJECT (parent), name, btn, g_object_unref);
+    gtk_widget_show (btn);
+
+    return btn;
+}
+
+
 GtkWidget *create_radio (GtkWidget *parent, GSList *group, const gchar *text, const gchar *name)
 {
     GtkWidget *btn = gtk_radio_button_new_with_label (group, text);
@@ -257,6 +285,18 @@ GtkWidget *create_radio (GtkWidget *parent, GSList *group, const gchar *text, co
 }
 
 
+GtkWidget *create_radio_with_mnemonic (GtkWidget *parent, GSList *group, gchar *text, gchar *name)
+{
+    GtkWidget *radio = gtk_radio_button_new_with_mnemonic (group, text);
+
+    g_object_ref (radio);
+    g_object_set_data_full (G_OBJECT (parent), name, radio, g_object_unref);
+    gtk_widget_show (radio);
+
+    return radio;
+}
+
+
 GtkWidget *create_spin (GtkWidget *parent, const gchar *name, gint min, gint max, gint value)
 {
     GtkObject *adj = gtk_adjustment_new (value, min, max, 1, 10, 0);
diff --git a/libgcmd/libgcmd-widget-factory.h b/libgcmd/libgcmd-widget-factory.h
index 8c82c0e..00b8371 100644
--- a/libgcmd/libgcmd-widget-factory.h
+++ b/libgcmd/libgcmd-widget-factory.h
@@ -47,6 +47,8 @@ inline GtkWidget *create_tabhbox (GtkWidget *parent)
 
 GtkWidget *create_label (GtkWidget *parent, const gchar *text);
 
+GtkWidget *create_label_with_mnemonic (GtkWidget *parent, const gchar *text, GtkWidget *for_widget);
+
 GtkWidget *create_bold_label (GtkWidget *parent, const gchar *text);
 
 GtkWidget *create_hsep (GtkWidget *parent);
@@ -95,8 +97,12 @@ GtkWidget *create_entry (GtkWidget *parent, const gchar *name, const gchar *valu
 
 GtkWidget *create_check (GtkWidget *parent, const gchar *text, const gchar *name);
 
+GtkWidget *create_check_with_mnemonic (GtkWidget *parent, const gchar *text, const gchar *name);
+
 GtkWidget *create_radio (GtkWidget *parent, GSList *group, const gchar *text, const gchar *name);
 
+GtkWidget *create_radio_with_mnemonic (GtkWidget *parent, GSList *group, gchar *text, gchar *name);
+
 GtkWidget *create_spin (GtkWidget *parent, const gchar *name, gint min, gint max, gint value);
 
 GtkWidget *create_color_button (GtkWidget *parent, const gchar *name);
diff --git a/src/gnome-cmd-search-dialog.cc b/src/gnome-cmd-search-dialog.cc
index 86a0824..9fdbf2a 100755
--- a/src/gnome-cmd-search-dialog.cc
+++ b/src/gnome-cmd-search-dialog.cc
@@ -694,55 +694,6 @@ static void find_text_toggled (GtkToggleButton *togglebutton, GnomeCmdSearchDial
 
 
 /*
- * create a label with keyboard shortcut and a widget to activate if shortcut is pressed.
- */
-inline GtkWidget *create_label_with_mnemonic (GtkWidget *parent, const gchar *text, GtkWidget *for_widget)
-{
-    GtkWidget *label = gtk_label_new_with_mnemonic (text);
-
-    if (for_widget)
-        gtk_label_set_mnemonic_widget (GTK_LABEL (label), for_widget);
-
-    g_object_ref (label);
-    g_object_set_data_full (G_OBJECT (parent), "label", label, g_object_unref);
-    gtk_widget_show (label);
-    gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
-
-    return label;
-}
-
-
-/*
- * create a check_box_button with keyboard shortcut
- */
-inline GtkWidget *create_check_with_mnemonic (GtkWidget *parent, const gchar *text, const gchar *name)
-{
-    GtkWidget *btn = gtk_check_button_new_with_mnemonic (text);
-
-    g_object_ref (btn);
-    g_object_set_data_full (G_OBJECT (parent), name, btn, g_object_unref);
-    gtk_widget_show (btn);
-
-    return btn;
-}
-
-
-/*
- * create a GtkRadioButton with keyboard shortcut
- */
-inline GtkWidget *create_radio_with_mnemonic (GtkWidget *parent, GSList *group, gchar *text, gchar *name)
-{
-    GtkWidget *radio = gtk_radio_button_new_with_mnemonic (group, text);
-
-    g_object_ref (radio);
-    g_object_set_data_full (G_OBJECT (parent), name, radio, g_object_unref);
-    gtk_widget_show (radio);
-
-    return radio;
-}
-
-
-/*
  * create a gtk_combo_box_entry_new_text. gtk_combo is deprecated.
  */
 inline GtkWidget *create_combo_box_entry (GtkWidget *parent)



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