Author: stephan
Date: 2008-05-11 10:36:10 +0000 (Sun, 11 May 2008)
New Revision: 26944

Modified:
   
xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/appearance-dialog.glade
   
xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/main.c
Log:
Modify toolbar-style


Modified: 
xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/appearance-dialog.glade
===================================================================
--- 
xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/appearance-dialog.glade
  2008-05-11 08:40:34 UTC (rev 26943)
+++ 
xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/appearance-dialog.glade
  2008-05-11 10:36:10 UTC (rev 26944)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.2 on Sun May 11 09:15:49 2008 -->
+<!--Generated with glade3 3.4.2 on Sun May 11 12:00:23 2008 -->
 <glade-interface>
   <requires lib="xfce4"/>
   <widget class="GtkDialog" id="appearance-settings-dialog">

Modified: 
xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/main.c
===================================================================
--- 
xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/main.c
   2008-05-11 08:40:34 UTC (rev 26943)
+++ 
xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/main.c
   2008-05-11 10:36:10 UTC (rev 26944)
@@ -44,6 +44,26 @@
     { NULL }
 };
 
+void
+cb_toolbar_style_combo_changed (GtkComboBox *combo, XfconfChannel *channel)
+{
+    switch (gtk_combo_box_get_active(combo))
+    {
+        case 0:
+            xfconf_channel_set_string (channel, "/Gtk/ToolbarStyle", "icons");
+            break;
+        case 1:
+            xfconf_channel_set_string (channel, "/Gtk/ToolbarStyle", "text");
+            break;
+        case 2:
+            xfconf_channel_set_string (channel, "/Gtk/ToolbarStyle", "both");
+            break;
+        case 3:
+            xfconf_channel_set_string (channel, "/Gtk/ToolbarStyle", 
"both-horiz");
+            break;
+    }
+}
+
 GtkWidget *
 appearance_settings_dialog_new_from_xml (GladeXML *gxml)
 {
@@ -53,10 +73,30 @@
     GtkWidget *menu_images = glade_xml_get_widget (gxml, 
"gtk_menu_images_check_button");
     GtkWidget *button_images = glade_xml_get_widget (gxml, 
"gtk_button_images_check_button");
     GtkWidget *fontname_button = glade_xml_get_widget (gxml, 
"gtk_fontname_button");
+    GtkWidget *toolbar_style_combo = glade_xml_get_widget (gxml, 
"gtk_toolbar_style_combo_box");
 
     GtkWidget *antialias_check_button = glade_xml_get_widget (gxml, 
"xft_antialias_check_button");
 
+    /* Fill the combo-boxes */
+    GtkTreeIter iter;
+    GtkListStore *list_store = gtk_list_store_new(1, G_TYPE_STRING);
+    gtk_list_store_append(list_store, &iter);
+    gtk_list_store_set(list_store, &iter, 0, N_("Icons"), -1);
+    gtk_list_store_append(list_store, &iter);
+    gtk_list_store_set(list_store, &iter, 0, N_("Text"), -1);
+    gtk_list_store_append(list_store, &iter);
+    gtk_list_store_set(list_store, &iter, 0, N_("Both"), -1);
+    gtk_list_store_append(list_store, &iter);
+    gtk_list_store_set(list_store, &iter, 0, N_("Both Horizontal"), -1);
+    
+    /* Should not need to clear the cell layout, doing it anyways. just to be 
sure */
+    gtk_cell_layout_clear (GTK_CELL_LAYOUT (toolbar_style_combo));
+    GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
+    gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (toolbar_style_combo), 
renderer, TRUE);
+    gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (toolbar_style_combo), 
renderer, "text", 0);
 
+    gtk_combo_box_set_model (GTK_COMBO_BOX (toolbar_style_combo), 
GTK_TREE_MODEL(list_store));
+
     /* Bind easy properties */
     xfconf_g_property_bind (xsettings_channel, 
                             "/Gtk/CanChangeAccels",
@@ -75,7 +115,20 @@
                             "/Gtk/FontName",
                             G_TYPE_STRING,
                             (GObject *)fontname_button, "font-name"); 
+    /* Less easy properties */
+    gchar *toolbar_style_string = xfconf_channel_get_string 
(xsettings_channel, "/Gtk/ToolbarStyle", "Both");
+    if (!strcmp(toolbar_style_string, "icons"))
+        gtk_combo_box_set_active (GTK_COMBO_BOX(toolbar_style_combo), 0);
+    if (!strcmp(toolbar_style_string, "text"))
+        gtk_combo_box_set_active (GTK_COMBO_BOX(toolbar_style_combo), 1);
+    if (!strcmp(toolbar_style_string, "both"))
+        gtk_combo_box_set_active (GTK_COMBO_BOX(toolbar_style_combo), 2);
+    if (!strcmp(toolbar_style_string, "both-horiz"))
+        gtk_combo_box_set_active (GTK_COMBO_BOX(toolbar_style_combo), 3);
+    g_free (toolbar_style_string);
+    g_signal_connect (G_OBJECT(toolbar_style_combo), "changed", 
G_CALLBACK(cb_toolbar_style_combo_changed), xsettings_channel);
 
+
     GtkWidget *dialog = glade_xml_get_widget (gxml, 
"appearance-settings-dialog");
     return dialog;
 }
@@ -117,7 +170,7 @@
 
     GtkWidget *dialog = appearance_settings_dialog_new_from_xml (gxml);
 
-    gtk_dialog_run(dialog);
+    gtk_dialog_run(GTK_DIALOG(dialog));
 
     
     xfconf_shutdown();

_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to