Update files and themes on selection changed.
authorHong Jen Yee (PCMan) <pcman.tw@gmail.com>
Tue, 25 Mar 2008 23:24:54 +0000 (23:24 +0000)
committerHong Jen Yee (PCMan) <pcman.tw@gmail.com>
Tue, 25 Mar 2008 23:24:54 +0000 (23:24 +0000)
lxappearance.glade
src/Makefile.am
src/main-dlg-ui.c
src/main-dlg.c
src/main-dlg.h
src/main.c

index 797ba6d..9b94e60 100644 (file)
@@ -19,7 +19,7 @@
   <property name="focus_on_map">True</property>
   <property name="urgency_hint">False</property>
   <property name="has_separator">True</property>
-  <signal name="delete_event" handler="gtk_main_quit" last_modification_time="Sun, 23 Mar 2008 02:26:36 GMT"/>
+  <signal name="delete_event" handler="gtk_main_quit"/>
 
   <child internal-child="vbox">
     <widget class="GtkVBox" id="dialog-vbox1">
@@ -42,7 +42,7 @@
              <property name="relief">GTK_RELIEF_NORMAL</property>
              <property name="focus_on_click">True</property>
              <property name="response_id">-10</property>
-             <signal name="clicked" handler="on_apply_clicked" last_modification_time="Sun, 23 Mar 2008 02:40:08 GMT"/>
+             <signal name="clicked" handler="on_apply_clicked"/>
            </widget>
          </child>
 
@@ -56,7 +56,7 @@
              <property name="relief">GTK_RELIEF_NORMAL</property>
              <property name="focus_on_click">True</property>
              <property name="response_id">-7</property>
-             <signal name="clicked" handler="gtk_main_quit" last_modification_time="Sun, 23 Mar 2008 02:26:06 GMT"/>
+             <signal name="clicked" handler="gtk_main_quit"/>
            </widget>
          </child>
        </widget>
                      <property name="fill">True</property>
                    </packing>
                  </child>
-               </widget>
-               <packing>
-                 <property name="tab_expand">False</property>
-                 <property name="tab_fill">True</property>
-               </packing>
-             </child>
-
-             <child>
-               <widget class="GtkLabel" id="label2">
-                 <property name="visible">True</property>
-                 <property name="label" translatable="yes">Window</property>
-                 <property name="use_underline">False</property>
-                 <property name="use_markup">False</property>
-                 <property name="justify">GTK_JUSTIFY_LEFT</property>
-                 <property name="wrap">False</property>
-                 <property name="selectable">False</property>
-                 <property name="xalign">0.5</property>
-                 <property name="yalign">0.5</property>
-                 <property name="xpad">0</property>
-                 <property name="ypad">0</property>
-                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                 <property name="width_chars">-1</property>
-                 <property name="single_line_mode">False</property>
-                 <property name="angle">0</property>
-               </widget>
-               <packing>
-                 <property name="type">tab</property>
-               </packing>
-             </child>
-
-             <child>
-               <widget class="GtkVBox" id="vbox3">
-                 <property name="visible">True</property>
-                 <property name="homogeneous">False</property>
-                 <property name="spacing">0</property>
 
                  <child>
-                   <widget class="GtkLabel" id="label7">
+                   <widget class="GtkHBox" id="hbox4">
                      <property name="visible">True</property>
-                     <property name="label" translatable="yes">Available Icon Themes</property>
-                     <property name="use_underline">False</property>
-                     <property name="use_markup">False</property>
-                     <property name="justify">GTK_JUSTIFY_LEFT</property>
-                     <property name="wrap">False</property>
-                     <property name="selectable">False</property>
-                     <property name="xalign">0.5</property>
-                     <property name="yalign">0.5</property>
-                     <property name="xpad">0</property>
-                     <property name="ypad">0</property>
-                     <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                     <property name="width_chars">-1</property>
-                     <property name="single_line_mode">False</property>
-                     <property name="angle">0</property>
-                   </widget>
-                   <packing>
-                     <property name="padding">0</property>
-                     <property name="expand">False</property>
-                     <property name="fill">False</property>
-                   </packing>
-                 </child>
+                     <property name="homogeneous">False</property>
+                     <property name="spacing">0</property>
 
-                 <child>
-                   <widget class="GtkScrolledWindow" id="scrolledwindow2">
-                     <property name="visible">True</property>
-                     <property name="can_focus">True</property>
-                     <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-                     <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-                     <property name="shadow_type">GTK_SHADOW_IN</property>
-                     <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+                     <child>
+                       <widget class="GtkLabel" id="label17">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">_Font:</property>
+                         <property name="use_underline">True</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">False</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0.5</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                         <property name="mnemonic_widget">font</property>
+                         <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                         <property name="width_chars">-1</property>
+                         <property name="single_line_mode">False</property>
+                         <property name="angle">0</property>
+                       </widget>
+                       <packing>
+                         <property name="padding">4</property>
+                         <property name="expand">False</property>
+                         <property name="fill">True</property>
+                       </packing>
+                     </child>
 
                      <child>
-                       <widget class="GtkTreeView" id="icon_theme_view">
+                       <widget class="GtkFontButton" id="font">
+                         <property name="border_width">2</property>
+                         <property name="width_request">64</property>
                          <property name="visible">True</property>
                          <property name="can_focus">True</property>
-                         <property name="headers_visible">False</property>
-                         <property name="rules_hint">False</property>
-                         <property name="reorderable">False</property>
-                         <property name="enable_search">True</property>
-                         <property name="fixed_height_mode">False</property>
-                         <property name="hover_selection">False</property>
-                         <property name="hover_expand">False</property>
+                         <property name="show_style">True</property>
+                         <property name="show_size">True</property>
+                         <property name="use_font">True</property>
+                         <property name="use_size">True</property>
+                         <property name="focus_on_click">True</property>
+                         <signal name="font_set" handler="on_font_changed" last_modification_time="Tue, 25 Mar 2008 23:18:15 GMT"/>
                        </widget>
+                       <packing>
+                         <property name="padding">0</property>
+                         <property name="expand">True</property>
+                         <property name="fill">True</property>
+                       </packing>
                      </child>
                    </widget>
                    <packing>
-                     <property name="padding">0</property>
-                     <property name="expand">True</property>
-                     <property name="fill">True</property>
+                     <property name="padding">4</property>
+                     <property name="expand">False</property>
+                     <property name="fill">False</property>
                    </packing>
                  </child>
                </widget>
              </child>
 
              <child>
-               <widget class="GtkLabel" id="label3">
+               <widget class="GtkLabel" id="label2">
                  <property name="visible">True</property>
-                 <property name="label" translatable="yes">Icon</property>
+                 <property name="label" translatable="yes">Window</property>
                  <property name="use_underline">False</property>
                  <property name="use_markup">False</property>
                  <property name="justify">GTK_JUSTIFY_LEFT</property>
              </child>
 
              <child>
-               <widget class="GtkVBox" id="vbox2">
+               <widget class="GtkVBox" id="vbox3">
                  <property name="visible">True</property>
                  <property name="homogeneous">False</property>
                  <property name="spacing">0</property>
 
                  <child>
-                   <widget class="GtkLabel" id="label6">
+                   <widget class="GtkLabel" id="label7">
                      <property name="visible">True</property>
-                     <property name="label" translatable="yes">Available Fonts</property>
+                     <property name="label" translatable="yes">Available Icon Themes</property>
                      <property name="use_underline">False</property>
                      <property name="use_markup">False</property>
                      <property name="justify">GTK_JUSTIFY_LEFT</property>
                  </child>
 
                  <child>
-                   <widget class="GtkScrolledWindow" id="scrolledwindow3">
+                   <widget class="GtkScrolledWindow" id="scrolledwindow2">
                      <property name="visible">True</property>
                      <property name="can_focus">True</property>
                      <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
                      <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
 
                      <child>
-                       <widget class="GtkTreeView" id="font_view">
+                       <widget class="GtkTreeView" id="icon_theme_view">
                          <property name="visible">True</property>
                          <property name="can_focus">True</property>
                          <property name="headers_visible">False</property>
                      <property name="fill">True</property>
                    </packing>
                  </child>
-
-                 <child>
-                   <widget class="GtkTable" id="table1">
-                     <property name="visible">True</property>
-                     <property name="n_rows">2</property>
-                     <property name="n_columns">2</property>
-                     <property name="homogeneous">False</property>
-                     <property name="row_spacing">0</property>
-                     <property name="column_spacing">0</property>
-
-                     <child>
-                       <widget class="GtkLabel" id="label9">
-                         <property name="visible">True</property>
-                         <property name="label" translatable="yes">Font Size:</property>
-                         <property name="use_underline">False</property>
-                         <property name="use_markup">False</property>
-                         <property name="justify">GTK_JUSTIFY_LEFT</property>
-                         <property name="wrap">False</property>
-                         <property name="selectable">False</property>
-                         <property name="xalign">0.5</property>
-                         <property name="yalign">0.5</property>
-                         <property name="xpad">0</property>
-                         <property name="ypad">0</property>
-                         <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                         <property name="width_chars">-1</property>
-                         <property name="single_line_mode">False</property>
-                         <property name="angle">0</property>
-                       </widget>
-                       <packing>
-                         <property name="left_attach">0</property>
-                         <property name="right_attach">1</property>
-                         <property name="top_attach">0</property>
-                         <property name="bottom_attach">1</property>
-                         <property name="x_options">fill</property>
-                         <property name="y_options"></property>
-                       </packing>
-                     </child>
-
-                     <child>
-                       <widget class="GtkComboBoxEntry" id="comboboxentry1">
-                         <property name="width_request">48</property>
-                         <property name="visible">True</property>
-                         <property name="add_tearoffs">False</property>
-                         <property name="has_frame">True</property>
-                         <property name="focus_on_click">True</property>
-                       </widget>
-                       <packing>
-                         <property name="left_attach">1</property>
-                         <property name="right_attach">2</property>
-                         <property name="top_attach">0</property>
-                         <property name="bottom_attach">1</property>
-                         <property name="y_options">fill</property>
-                       </packing>
-                     </child>
-
-                     <child>
-                       <widget class="GtkLabel" id="label10">
-                         <property name="visible">True</property>
-                         <property name="label" translatable="yes">Style:</property>
-                         <property name="use_underline">False</property>
-                         <property name="use_markup">False</property>
-                         <property name="justify">GTK_JUSTIFY_LEFT</property>
-                         <property name="wrap">False</property>
-                         <property name="selectable">False</property>
-                         <property name="xalign">0</property>
-                         <property name="yalign">0.5</property>
-                         <property name="xpad">0</property>
-                         <property name="ypad">0</property>
-                         <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                         <property name="width_chars">-1</property>
-                         <property name="single_line_mode">False</property>
-                         <property name="angle">0</property>
-                       </widget>
-                       <packing>
-                         <property name="left_attach">0</property>
-                         <property name="right_attach">1</property>
-                         <property name="top_attach">1</property>
-                         <property name="bottom_attach">2</property>
-                         <property name="x_options">fill</property>
-                         <property name="y_options"></property>
-                       </packing>
-                     </child>
-
-                     <child>
-                       <widget class="GtkComboBox" id="combobox1">
-                         <property name="visible">True</property>
-                         <property name="add_tearoffs">False</property>
-                         <property name="focus_on_click">True</property>
-                       </widget>
-                       <packing>
-                         <property name="left_attach">1</property>
-                         <property name="right_attach">2</property>
-                         <property name="top_attach">1</property>
-                         <property name="bottom_attach">2</property>
-                         <property name="x_options">fill</property>
-                         <property name="y_options">fill</property>
-                       </packing>
-                     </child>
-                   </widget>
-                   <packing>
-                     <property name="padding">0</property>
-                     <property name="expand">False</property>
-                     <property name="fill">True</property>
-                   </packing>
-                 </child>
-
-                 <child>
-                   <placeholder/>
-                 </child>
                </widget>
                <packing>
                  <property name="tab_expand">False</property>
              </child>
 
              <child>
-               <widget class="GtkLabel" id="label4">
+               <widget class="GtkLabel" id="label3">
                  <property name="visible">True</property>
-                 <property name="label" translatable="yes">Font</property>
+                 <property name="label" translatable="yes">Icon</property>
                  <property name="use_underline">False</property>
                  <property name="use_markup">False</property>
                  <property name="justify">GTK_JUSTIFY_LEFT</property>
                  <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
 
                  <child>
-                   <widget class="GtkAlignment" id="alignment1">
+                   <widget class="GtkAlignment" id="demo_box">
                      <property name="visible">True</property>
                      <property name="xalign">0.5</property>
                      <property name="yalign">0.5</property>
                      <property name="right_padding">4</property>
 
                      <child>
-                       <widget class="GtkVBox" id="vbox5">
+                       <widget class="GtkVBox" id="top_vbox">
                          <property name="visible">True</property>
                          <property name="homogeneous">False</property>
                          <property name="spacing">0</property>
+                         <signal name="destroy" handler="gtk_main_quit"/>
 
                          <child>
                            <widget class="GtkMenuBar" id="menubar1">
                          </child>
 
                          <child>
-                           <widget class="GtkToolbar" id="toolbar1">
+                           <widget class="GtkHandleBox" id="handlebox1">
                              <property name="visible">True</property>
-                             <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
-                             <property name="toolbar_style">GTK_TOOLBAR_BOTH</property>
-                             <property name="tooltips">True</property>
-                             <property name="show_arrow">False</property>
+                             <property name="shadow_type">GTK_SHADOW_OUT</property>
+                             <property name="handle_position">GTK_POS_LEFT</property>
+                             <property name="snap_edge">GTK_POS_TOP</property>
 
                              <child>
-                               <widget class="GtkToolButton" id="toolbutton1">
+                               <widget class="GtkToolbar" id="toolbar1">
                                  <property name="visible">True</property>
-                                 <property name="tooltip" translatable="yes">Back</property>
-                                 <property name="stock_id">gtk-go-back</property>
-                                 <property name="visible_horizontal">True</property>
-                                 <property name="visible_vertical">True</property>
-                                 <property name="is_important">False</property>
-                               </widget>
-                               <packing>
-                                 <property name="expand">False</property>
-                                 <property name="homogeneous">True</property>
-                               </packing>
-                             </child>
+                                 <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
+                                 <property name="toolbar_style">GTK_TOOLBAR_BOTH</property>
+                                 <property name="tooltips">True</property>
+                                 <property name="show_arrow">False</property>
 
-                             <child>
-                               <widget class="GtkToolButton" id="toolbutton2">
-                                 <property name="visible">True</property>
-                                 <property name="tooltip" translatable="yes">Forward</property>
-                                 <property name="stock_id">gtk-go-forward</property>
-                                 <property name="visible_horizontal">True</property>
-                                 <property name="visible_vertical">True</property>
-                                 <property name="is_important">False</property>
-                               </widget>
-                               <packing>
-                                 <property name="expand">False</property>
-                                 <property name="homogeneous">True</property>
-                               </packing>
-                             </child>
+                                 <child>
+                                   <widget class="GtkToolButton" id="toolbutton1">
+                                     <property name="visible">True</property>
+                                     <property name="tooltip" translatable="yes">Back</property>
+                                     <property name="stock_id">gtk-go-back</property>
+                                     <property name="visible_horizontal">True</property>
+                                     <property name="visible_vertical">True</property>
+                                     <property name="is_important">False</property>
+                                   </widget>
+                                   <packing>
+                                     <property name="expand">False</property>
+                                     <property name="homogeneous">True</property>
+                                   </packing>
+                                 </child>
 
-                             <child>
-                               <widget class="GtkToolButton" id="toolbutton3">
-                                 <property name="visible">True</property>
-                                 <property name="tooltip" translatable="yes">Stop</property>
-                                 <property name="stock_id">gtk-stop</property>
-                                 <property name="visible_horizontal">True</property>
-                                 <property name="visible_vertical">True</property>
-                                 <property name="is_important">False</property>
+                                 <child>
+                                   <widget class="GtkToolButton" id="toolbutton2">
+                                     <property name="visible">True</property>
+                                     <property name="tooltip" translatable="yes">Forward</property>
+                                     <property name="stock_id">gtk-go-forward</property>
+                                     <property name="visible_horizontal">True</property>
+                                     <property name="visible_vertical">True</property>
+                                     <property name="is_important">False</property>
+                                   </widget>
+                                   <packing>
+                                     <property name="expand">False</property>
+                                     <property name="homogeneous">True</property>
+                                   </packing>
+                                 </child>
+
+                                 <child>
+                                   <widget class="GtkToolButton" id="toolbutton3">
+                                     <property name="visible">True</property>
+                                     <property name="tooltip" translatable="yes">Stop</property>
+                                     <property name="stock_id">gtk-stop</property>
+                                     <property name="visible_horizontal">True</property>
+                                     <property name="visible_vertical">True</property>
+                                     <property name="is_important">False</property>
+                                   </widget>
+                                   <packing>
+                                     <property name="expand">False</property>
+                                     <property name="homogeneous">True</property>
+                                   </packing>
+                                 </child>
                                </widget>
-                               <packing>
-                                 <property name="expand">False</property>
-                                 <property name="homogeneous">True</property>
-                               </packing>
                              </child>
                            </widget>
                            <packing>
@@ -1129,7 +999,7 @@ Test Item 3</property>
                                      <property name="left_margin">0</property>
                                      <property name="right_margin">0</property>
                                      <property name="indent">0</property>
-                                     <property name="text" translatable="yes"></property>
+                                     <property name="text" translatable="yes">Type some characters here to test currently selected font.</property>
                                    </widget>
                                  </child>
                                </widget>
index 126acb7..2e701bb 100644 (file)
@@ -11,7 +11,9 @@ lxappearance_SOURCES = \
        main.c \
        glade-support.c glade-support.h \
        main-dlg-ui.c main-dlg-ui.h \
-       main-dlg.c main-dlg.h
+       main-dlg.c main-dlg.h \
+       demo-ui.c demo-ui.h \
+       demo.c demo.h
 
 lxappearance_LDADD = @PACKAGE_LIBS@ $(INTLLIBS)
 
index 5ab7551..7519a95 100644 (file)
@@ -37,29 +37,22 @@ create_dlg (void)
   GtkWidget *label8;
   GtkWidget *scrolledwindow1;
   GtkWidget *gtk_theme_view;
+  GtkWidget *hbox4;
+  GtkWidget *label17;
+  GtkWidget *font;
   GtkWidget *label2;
   GtkWidget *vbox3;
   GtkWidget *label7;
   GtkWidget *scrolledwindow2;
   GtkWidget *icon_theme_view;
   GtkWidget *label3;
-  GtkWidget *vbox2;
-  GtkWidget *label6;
-  GtkWidget *scrolledwindow3;
-  GtkWidget *font_view;
-  GtkWidget *table1;
-  GtkWidget *label9;
-  GtkWidget *comboboxentry1;
-  GtkWidget *label10;
-  GtkWidget *combobox1;
-  GtkWidget *label4;
   GtkWidget *empty_notebook_page;
   GtkWidget *label5;
   GtkWidget *vbox1;
   GtkWidget *label15;
   GtkWidget *frame1;
-  GtkWidget *alignment1;
-  GtkWidget *vbox5;
+  GtkWidget *demo_box;
+  GtkWidget *top_vbox;
   GtkWidget *menubar1;
   GtkWidget *menuitem1;
   GtkWidget *menuitem1_menu;
@@ -78,6 +71,7 @@ create_dlg (void)
   GtkWidget *menuitem4;
   GtkWidget *menuitem4_menu;
   GtkWidget *about1;
+  GtkWidget *handlebox1;
   GtkWidget *toolbar1;
   GtkIconSize tmp_toolbar_icon_size;
   GtkWidget *toolbutton1;
@@ -155,6 +149,22 @@ create_dlg (void)
   gtk_container_add (GTK_CONTAINER (scrolledwindow1), gtk_theme_view);
   gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (gtk_theme_view), FALSE);
 
+  hbox4 = gtk_hbox_new (FALSE, 0);
+  gtk_widget_show (hbox4);
+  gtk_box_pack_start (GTK_BOX (vbox4), hbox4, FALSE, FALSE, 4);
+
+  label17 = gtk_label_new_with_mnemonic (_("_Font:"));
+  gtk_widget_show (label17);
+  gtk_box_pack_start (GTK_BOX (hbox4), label17, FALSE, TRUE, 4);
+
+  font = gtk_font_button_new ();
+  gtk_widget_show (font);
+  gtk_box_pack_start (GTK_BOX (hbox4), font, TRUE, TRUE, 0);
+  gtk_widget_set_size_request (font, 64, -1);
+  gtk_container_set_border_width (GTK_CONTAINER (font), 2);
+  gtk_font_button_set_use_font (GTK_FONT_BUTTON (font), TRUE);
+  gtk_font_button_set_use_size (GTK_FONT_BUTTON (font), TRUE);
+
   label2 = gtk_label_new (_("Window"));
   gtk_widget_show (label2);
   gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label2);
@@ -182,66 +192,13 @@ create_dlg (void)
   gtk_widget_show (label3);
   gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label3);
 
-  vbox2 = gtk_vbox_new (FALSE, 0);
-  gtk_widget_show (vbox2);
-  gtk_container_add (GTK_CONTAINER (notebook1), vbox2);
-
-  label6 = gtk_label_new (_("Available Fonts"));
-  gtk_widget_show (label6);
-  gtk_box_pack_start (GTK_BOX (vbox2), label6, FALSE, FALSE, 0);
-
-  scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL);
-  gtk_widget_show (scrolledwindow3);
-  gtk_box_pack_start (GTK_BOX (vbox2), scrolledwindow3, TRUE, TRUE, 0);
-  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_SHADOW_IN);
-
-  font_view = gtk_tree_view_new ();
-  gtk_widget_show (font_view);
-  gtk_container_add (GTK_CONTAINER (scrolledwindow3), font_view);
-  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (font_view), FALSE);
-
-  table1 = gtk_table_new (2, 2, FALSE);
-  gtk_widget_show (table1);
-  gtk_box_pack_start (GTK_BOX (vbox2), table1, FALSE, TRUE, 0);
-
-  label9 = gtk_label_new (_("Font Size:"));
-  gtk_widget_show (label9);
-  gtk_table_attach (GTK_TABLE (table1), label9, 0, 1, 0, 1,
-                    (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-
-  comboboxentry1 = gtk_combo_box_entry_new_text ();
-  gtk_widget_show (comboboxentry1);
-  gtk_table_attach (GTK_TABLE (table1), comboboxentry1, 1, 2, 0, 1,
-                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-                    (GtkAttachOptions) (GTK_FILL), 0, 0);
-  gtk_widget_set_size_request (comboboxentry1, 48, -1);
-
-  label10 = gtk_label_new (_("Style:"));
-  gtk_widget_show (label10);
-  gtk_table_attach (GTK_TABLE (table1), label10, 0, 1, 1, 2,
-                    (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-  gtk_misc_set_alignment (GTK_MISC (label10), 0, 0.5);
-
-  combobox1 = gtk_combo_box_new_text ();
-  gtk_widget_show (combobox1);
-  gtk_table_attach (GTK_TABLE (table1), combobox1, 1, 2, 1, 2,
-                    (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (GTK_FILL), 0, 0);
-
-  label4 = gtk_label_new (_("Font"));
-  gtk_widget_show (label4);
-  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 2), label4);
-
   empty_notebook_page = gtk_vbox_new (FALSE, 0);
   gtk_widget_show (empty_notebook_page);
   gtk_container_add (GTK_CONTAINER (notebook1), empty_notebook_page);
 
   label5 = gtk_label_new (_("Other"));
   gtk_widget_show (label5);
-  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 3), label5);
+  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 2), label5);
 
   vbox1 = gtk_vbox_new (FALSE, 0);
   gtk_widget_show (vbox1);
@@ -257,18 +214,18 @@ create_dlg (void)
   gtk_box_pack_start (GTK_BOX (vbox1), frame1, TRUE, TRUE, 0);
   gtk_container_set_border_width (GTK_CONTAINER (frame1), 6);
 
-  alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
-  gtk_widget_show (alignment1);
-  gtk_container_add (GTK_CONTAINER (frame1), alignment1);
-  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 4, 4);
+  demo_box = gtk_alignment_new (0.5, 0.5, 1, 1);
+  gtk_widget_show (demo_box);
+  gtk_container_add (GTK_CONTAINER (frame1), demo_box);
+  gtk_alignment_set_padding (GTK_ALIGNMENT (demo_box), 0, 0, 4, 4);
 
-  vbox5 = gtk_vbox_new (FALSE, 0);
-  gtk_widget_show (vbox5);
-  gtk_container_add (GTK_CONTAINER (alignment1), vbox5);
+  top_vbox = gtk_vbox_new (FALSE, 0);
+  gtk_widget_show (top_vbox);
+  gtk_container_add (GTK_CONTAINER (demo_box), top_vbox);
 
   menubar1 = gtk_menu_bar_new ();
   gtk_widget_show (menubar1);
-  gtk_box_pack_start (GTK_BOX (vbox5), menubar1, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (top_vbox), menubar1, FALSE, FALSE, 0);
 
   menuitem1 = gtk_menu_item_new_with_mnemonic (_("_File"));
   gtk_widget_show (menuitem1);
@@ -336,9 +293,13 @@ create_dlg (void)
   gtk_widget_show (about1);
   gtk_container_add (GTK_CONTAINER (menuitem4_menu), about1);
 
+  handlebox1 = gtk_handle_box_new ();
+  gtk_widget_show (handlebox1);
+  gtk_box_pack_start (GTK_BOX (top_vbox), handlebox1, FALSE, FALSE, 0);
+
   toolbar1 = gtk_toolbar_new ();
   gtk_widget_show (toolbar1);
-  gtk_box_pack_start (GTK_BOX (vbox5), toolbar1, FALSE, FALSE, 0);
+  gtk_container_add (GTK_CONTAINER (handlebox1), toolbar1);
   gtk_toolbar_set_style (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_BOTH);
   gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar1), FALSE);
   tmp_toolbar_icon_size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (toolbar1));
@@ -360,7 +321,7 @@ create_dlg (void)
 
   notebook2 = gtk_notebook_new ();
   gtk_widget_show (notebook2);
-  gtk_box_pack_start (GTK_BOX (vbox5), notebook2, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (top_vbox), notebook2, TRUE, TRUE, 0);
 
   scrolledwindow4 = gtk_scrolled_window_new (NULL, NULL);
   gtk_widget_show (scrolledwindow4);
@@ -472,6 +433,7 @@ create_dlg (void)
   text_view = gtk_text_view_new ();
   gtk_widget_show (text_view);
   gtk_container_add (GTK_CONTAINER (scrolledwindow5), text_view);
+  gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view)), _("Type some characters here to test currently selected font."), -1);
 
   label14 = gtk_label_new (_("Tab3"));
   gtk_widget_show (label14);
@@ -479,7 +441,7 @@ create_dlg (void)
 
   statusbar1 = gtk_statusbar_new ();
   gtk_widget_show (statusbar1);
-  gtk_box_pack_start (GTK_BOX (vbox5), statusbar1, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (top_vbox), statusbar1, FALSE, FALSE, 0);
 
   dialog_action_area1 = GTK_DIALOG (dlg)->action_area;
   gtk_widget_show (dialog_action_area1);
@@ -498,6 +460,12 @@ create_dlg (void)
   g_signal_connect ((gpointer) dlg, "delete_event",
                     G_CALLBACK (gtk_main_quit),
                     NULL);
+  g_signal_connect ((gpointer) font, "font_set",
+                    G_CALLBACK (on_font_changed),
+                    NULL);
+  g_signal_connect ((gpointer) top_vbox, "destroy",
+                    G_CALLBACK (gtk_main_quit),
+                    NULL);
   g_signal_connect ((gpointer) apply, "clicked",
                     G_CALLBACK (on_apply_clicked),
                     NULL);
@@ -505,6 +473,8 @@ create_dlg (void)
                     G_CALLBACK (gtk_main_quit),
                     NULL);
 
+  gtk_label_set_mnemonic_widget (GTK_LABEL (label17), font);
+
   /* Store pointers to all widgets, for use by lookup_widget(). */
   GLADE_HOOKUP_OBJECT_NO_REF (dlg, dlg, "dlg");
   GLADE_HOOKUP_OBJECT_NO_REF (dlg, dialog_vbox1, "dialog_vbox1");
@@ -514,28 +484,21 @@ create_dlg (void)
   GLADE_HOOKUP_OBJECT (dlg, label8, "label8");
   GLADE_HOOKUP_OBJECT (dlg, scrolledwindow1, "scrolledwindow1");
   GLADE_HOOKUP_OBJECT (dlg, gtk_theme_view, "gtk_theme_view");
+  GLADE_HOOKUP_OBJECT (dlg, hbox4, "hbox4");
+  GLADE_HOOKUP_OBJECT (dlg, label17, "label17");
+  GLADE_HOOKUP_OBJECT (dlg, font, "font");
   GLADE_HOOKUP_OBJECT (dlg, label2, "label2");
   GLADE_HOOKUP_OBJECT (dlg, vbox3, "vbox3");
   GLADE_HOOKUP_OBJECT (dlg, label7, "label7");
   GLADE_HOOKUP_OBJECT (dlg, scrolledwindow2, "scrolledwindow2");
   GLADE_HOOKUP_OBJECT (dlg, icon_theme_view, "icon_theme_view");
   GLADE_HOOKUP_OBJECT (dlg, label3, "label3");
-  GLADE_HOOKUP_OBJECT (dlg, vbox2, "vbox2");
-  GLADE_HOOKUP_OBJECT (dlg, label6, "label6");
-  GLADE_HOOKUP_OBJECT (dlg, scrolledwindow3, "scrolledwindow3");
-  GLADE_HOOKUP_OBJECT (dlg, font_view, "font_view");
-  GLADE_HOOKUP_OBJECT (dlg, table1, "table1");
-  GLADE_HOOKUP_OBJECT (dlg, label9, "label9");
-  GLADE_HOOKUP_OBJECT (dlg, comboboxentry1, "comboboxentry1");
-  GLADE_HOOKUP_OBJECT (dlg, label10, "label10");
-  GLADE_HOOKUP_OBJECT (dlg, combobox1, "combobox1");
-  GLADE_HOOKUP_OBJECT (dlg, label4, "label4");
   GLADE_HOOKUP_OBJECT (dlg, label5, "label5");
   GLADE_HOOKUP_OBJECT (dlg, vbox1, "vbox1");
   GLADE_HOOKUP_OBJECT (dlg, label15, "label15");
   GLADE_HOOKUP_OBJECT (dlg, frame1, "frame1");
-  GLADE_HOOKUP_OBJECT (dlg, alignment1, "alignment1");
-  GLADE_HOOKUP_OBJECT (dlg, vbox5, "vbox5");
+  GLADE_HOOKUP_OBJECT (dlg, demo_box, "demo_box");
+  GLADE_HOOKUP_OBJECT (dlg, top_vbox, "top_vbox");
   GLADE_HOOKUP_OBJECT (dlg, menubar1, "menubar1");
   GLADE_HOOKUP_OBJECT (dlg, menuitem1, "menuitem1");
   GLADE_HOOKUP_OBJECT (dlg, menuitem1_menu, "menuitem1_menu");
@@ -554,6 +517,7 @@ create_dlg (void)
   GLADE_HOOKUP_OBJECT (dlg, menuitem4, "menuitem4");
   GLADE_HOOKUP_OBJECT (dlg, menuitem4_menu, "menuitem4_menu");
   GLADE_HOOKUP_OBJECT (dlg, about1, "about1");
+  GLADE_HOOKUP_OBJECT (dlg, handlebox1, "handlebox1");
   GLADE_HOOKUP_OBJECT (dlg, toolbar1, "toolbar1");
   GLADE_HOOKUP_OBJECT (dlg, toolbutton1, "toolbutton1");
   GLADE_HOOKUP_OBJECT (dlg, toolbutton2, "toolbutton2");
index 2827a7f..bd8d5bc 100644 (file)
@@ -3,11 +3,19 @@
 #endif
 
 #include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+
+#include <stdio.h>
 
 #include "main-dlg.h"
 #include "main-dlg-ui.h"
 #include "glade-support.h"
 
+/* for kill & waitpid */
+#include <sys/types.h>
+#include <signal.h>
+#include <sys/wait.h>
+
 #define GET_WIDGET( name )  name = lookup_widget( dlg, #name )
 #define INIT_LIST(name, prop) \
     GET_WIDGET( name##_view ); \
@@ -20,41 +28,34 @@ static GtkListStore* gtk_theme_list = NULL;
 static GtkTreeView* icon_theme_view = NULL;
 static GtkListStore* icon_theme_list = NULL;
 
+static char* gtk_theme_name = NULL;
+static char* icon_theme_name = NULL;
+static char* font_name = NULL;
+
+static char* tmp_file = "/tmp/gtkrc";
+
+/*
 static GtkTreeView* font_view = NULL;
 static GtkListStore* font_list = NULL;
+*/
+static GtkWidget* demo_socket = NULL;
+static GPid demo_pid = 0;
 
-static GtkIconView* icon_view = NULL;
-
-static void reload_demo_icons()
+static void write_rc_file( const char* path )
 {
-    static const char** icon_names[]={
-        "gnome-fs-home",
-        "gnome-fs-desktop",
-        "gnome-fs-directory",
-        "gnome-fs-trash-empty",
-        "gnome-fs-regular",
-        "gnome-fs-executable",
-        "gnome-mime-image",
-        "gnome-mime-text"
-    };
-
-    int i;
-    GtkIconTheme* theme = gtk_icon_theme_get_default();
-    GtkListStore* demo_icon_list;
-
-    demo_icon_list = gtk_list_store_new( 2, GDK_TYPE_PIXBUF, G_TYPE_STRING );
-
-    for( i = 0; i < G_N_ELEMENTS(icon_names); ++i )
+    FILE* f;
+    if( f = fopen( path, "w" ) )
     {
-        GtkTreeIter it;
-        GdkPixbuf* icon = gtk_icon_theme_load_icon( theme, icon_names[i], 32, 0, NULL );
-        gtk_list_store_append( demo_icon_list, &it );
-        gtk_list_store_set( demo_icon_list, &it, 0, icon, 1, icon_names[i], -1 );
-        if( icon )
-            g_object_unref( icon );
+        fputs( "# DO NOT EDIT!  This file will be overwritten by LXAppearance.\n"
+                 "# Any customization should be done in ~/.gtkrc-2.0.mine\n", f );
+
+        fprintf( f, "gtk-theme-name=\"%s\"\n", gtk_theme_name );
+        fprintf( f, "gtk-icon-theme-name=\"%s\"\n", icon_theme_name );
+        fprintf( f, "gtk-font-name=\"%s\"\n", font_name );
+        fprintf( f, "include \"%s/.gtkrc-2.0.mine\"\n", g_get_home_dir() );
+
+        fclose( f );
     }
-    gtk_icon_view_set_model( icon_view, demo_icon_list );
-    g_object_unref( demo_icon_list );
 }
 
 static void reload_theme()
@@ -71,15 +72,27 @@ static void on_list_sel_changed( GtkTreeSelection* sel, const char* prop )
     {
         char* name;
         gtk_tree_model_get( model, &it, 0, &name, -1 );
-        if( model == font_list )    /* this is a font */
-        {
 
+        if( model == gtk_theme_list )   /* gtk+ theme */
+        {
+            if( name && gtk_theme_name && 0 == strcmp( name, gtk_theme_name ) )
+                goto out;
+            g_free( gtk_theme_name );
+            gtk_theme_name = name;
+        g_debug("HERE: %s", gtk_theme_name);
+        }
+        else if( model == icon_theme_list )   /* icon theme */
+        {
+            if( name && icon_theme_name && 0 == strcmp( name, icon_theme_name ) )
+                goto out;
+            g_free( icon_theme_name );
+            icon_theme_name = name;
         }
-        g_object_set( gtk_settings_get_default(), prop, name, NULL );
+        write_rc_file( tmp_file );
+        gtk_rc_reparse_all_for_settings(gtk_settings_get_default(), TRUE);
+        return;
+    out:
         g_free( name );
-
-        if( model == icon_theme_list ) /* icon theme is changed */
-            reload_demo_icons();
     }
 }
 
@@ -87,9 +100,11 @@ static GtkListStore* init_tree_view( GtkTreeView* view, GCallback on_sel_changed
 {
     GtkTreeViewColumn* col;
     GtkListStore* list;
+    GtkTreeSelection* sel;
     col = gtk_tree_view_column_new_with_attributes( NULL, gtk_cell_renderer_text_new(), "text", 0, NULL );
     gtk_tree_view_append_column( view, col );
-    g_signal_connect( gtk_tree_view_get_selection(view), "changed", on_sel_changed, prop );
+    sel = gtk_tree_view_get_selection(view);
+    g_signal_connect( sel, "changed", on_sel_changed, prop );
 
     list = gtk_list_store_new( 1, G_TYPE_STRING );
     gtk_tree_view_set_model( view, (GtkTreeModel*)list );
@@ -99,7 +114,9 @@ static GtkListStore* init_tree_view( GtkTreeView* view, GCallback on_sel_changed
 
 static void load_themes_from_dir( GtkListStore* list,
                                                     const char* dir_path,
-                                                    const char* lookup )
+                                                    const char* lookup,
+                                                    GtkTreeSelection* sel,
+                                                    const char* init_sel )
 {
     GDir* dir;
     if( dir = g_dir_open( dir_path, 0, NULL ) )
@@ -113,6 +130,16 @@ static void load_themes_from_dir( GtkListStore* list,
                 GtkTreeIter it;
                 gtk_list_store_append( list, &it );
                 gtk_list_store_set( list, &it, 0, name, -1 );
+                if( 0 == strcmp( name, init_sel ) )
+                {
+                    GtkTreeView* view;
+                    GtkTreePath* tp;
+                    gtk_tree_selection_select_iter( sel, &it );
+                    view = gtk_tree_selection_get_tree_view( sel );
+                    tp = gtk_tree_model_get_path( (GtkTreeModel*)list, &it );
+                    gtk_tree_view_scroll_to_cell( view, tp, NULL, FALSE, 0, 0 );
+                    gtk_tree_path_free( tp );
+                }
             }
             g_free( file );
         }
@@ -122,7 +149,9 @@ static void load_themes_from_dir( GtkListStore* list,
 
 static void load_from_data_dirs( GtkListStore* list,
                                                 const char* relative_path,
-                                                const char* lookup )
+                                                const char* lookup,
+                                                GtkTreeSelection* sel,
+                                                const char* init_sel  )
 {
     const char* const *dirs = g_get_system_data_dirs();
     const char* const *dir;
@@ -130,46 +159,79 @@ static void load_from_data_dirs( GtkListStore* list,
     for( dir = dirs; *dir; ++dir )
     {
         dir_path = g_build_filename( *dir, relative_path, NULL );
-        load_themes_from_dir( list, dir_path, lookup );
+        load_themes_from_dir( list, dir_path, lookup, sel, init_sel );
         g_free( dir_path );
     }
     dir_path = g_build_filename( g_get_user_data_dir(), relative_path, NULL );
-    load_themes_from_dir( list, dir_path, lookup );
+    load_themes_from_dir( list, dir_path, lookup, sel, init_sel );
     g_free( dir_path );
 }
 
 static void load_gtk_themes( GtkListStore* list )
 {
-    load_from_data_dirs( list, "themes", "gtk-2.0" );
+    GtkTreeSelection* sel = gtk_tree_view_get_selection( gtk_theme_view );
+    load_from_data_dirs( list, "themes", "gtk-2.0", sel, gtk_theme_name );
 }
 
 static void load_icon_themes( GtkListStore* list )
 {
     char* path;
-    load_from_data_dirs( list, "icons", "index.theme" );
+    GtkTreeSelection* sel = gtk_tree_view_get_selection( icon_theme_view );
+    load_from_data_dirs( list, "icons", "index.theme", sel, icon_theme_name );
     path = g_build_filename( g_get_home_dir(), ".icons", NULL );
-    load_themes_from_dir( list, path, "index.theme" );
+    load_themes_from_dir( list, path, "index.theme", sel, icon_theme_name );
     g_free( path );
 }
 
+/*
 static void load_fonts( GtkListStore* list )
 {
 
 }
+*/
+
+static void load_demo_process()
+{
+    char* argv[]={ NULL, "demo", NULL, NULL };
+    char wid[16];
+
+    if( demo_pid > 0 ) /* kill old demo */
+    {
+
+    }
+    g_snprintf( wid, 16, "%ld", gtk_socket_get_id(demo_socket) );
+
+    argv[0] = g_get_prgname();
+    argv[2] = wid;
+    g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &demo_pid, NULL );
+}
 
 void main_dlg_init( GtkWidget* dlg )
 {
+    GtkWidget* demo_box;
+    char* files[] = { tmp_file, NULL };
+
+    g_object_get( gtk_settings_get_default(), "gtk-theme-name", &gtk_theme_name, NULL );
+    g_object_get( gtk_settings_get_default(), "gtk-icon-theme-name", &icon_theme_name, NULL );
+    g_object_get( gtk_settings_get_default(), "gtk-font-name", &font_name, NULL );
+
+    gtk_rc_set_default_files( files );
+    write_rc_file( tmp_file );
+    gtk_rc_reparse_all();
+
     INIT_LIST( gtk_theme, "gtk-theme-name" )
     INIT_LIST( icon_theme, "gtk-icon-theme-name" )
-    INIT_LIST( font, "gtk-font-name" )
-
-    GET_WIDGET( icon_view );
-    gtk_icon_view_set_pixbuf_column( icon_view, 0 );
-    gtk_icon_view_set_text_column( icon_view, 1 );
-    gtk_icon_view_set_item_width( icon_view, 64 );
-    gtk_icon_view_set_column_spacing( icon_view, 8 );
-    gtk_icon_view_set_row_spacing( icon_view, 8 );
-    reload_demo_icons();
+    /* INIT_LIST( font, "gtk-font-name" ) */
+/*
+    GET_WIDGET( demo_box );
+    demo_socket = gtk_socket_new();
+    gtk_widget_show( demo_socket );
+    gtk_widget_show( demo_box );
+    gtk_widget_set_app_paintable( demo_socket, TRUE );
+    gtk_container_add( (GtkContainer*)demo_box, demo_socket );
+    gtk_widget_realize( dlg );
+    load_demo_process();
+*/
 }
 
 void
@@ -179,3 +241,17 @@ on_apply_clicked                       (GtkButton       *button,
 
 }
 
+
+void
+on_font_changed                        (GtkFontButton   *fontbutton,
+                                        gpointer         user_data)
+{
+    const char* name = gtk_font_button_get_font_name(fontbutton);
+    if( name && font_name && 0 == strcmp( font_name ) )
+        return;
+    g_free( font_name );
+    font_name = g_strdup( name );
+    write_rc_file( tmp_file );
+    gtk_rc_reparse_all_for_settings( gtk_settings_get_default(), TRUE );
+}
+
index acad596..04f71f4 100644 (file)
@@ -5,3 +5,7 @@ void main_dlg_init( GtkWidget* dlg );
 void
 on_apply_clicked                       (GtkButton       *button,
                                         gpointer         user_data);
+
+void
+on_font_changed                        (GtkFontButton   *fontbutton,
+                                        gpointer         user_data);
index f4ce409..cea6fa5 100644 (file)
@@ -8,29 +8,53 @@
 #endif
 
 #include <gtk/gtk.h>
+#include <string.h>
 
 #include "main-dlg-ui.h"
+#include "demo.h"
 #include "glade-support.h"
 
-int
-main (int argc, char *argv[])
+static void reload_all_programs( gboolean icon_only )
 {
-  GtkWidget *dlg;
+    GdkEventClient event;
+    event.type = GDK_CLIENT_EVENT;
+    event.send_event = TRUE;
+    event.window = NULL;
+
+    if( icon_only )
+        event.message_type = gdk_atom_intern("_GTK_LOAD_ICONTHEMES", FALSE);
+    else
+        event.message_type = gdk_atom_intern("_GTK_READ_RCFILES", FALSE);
+
+    event.data_format = 8;
+    gdk_event_send_clientmessage_toall((GdkEvent *)&event);
+}
+
+int main (int argc, char *argv[])
+{
+    GtkWidget *dlg;
 
 #ifdef ENABLE_NLS
-  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
-  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-  textdomain (GETTEXT_PACKAGE);
+    bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+    textdomain (GETTEXT_PACKAGE);
 #endif
 
-  gtk_set_locale ();
-  gtk_init (&argc, &argv);
+    gtk_set_locale ();
+    gtk_init (&argc, &argv);
+
+    if( argc >= 3 && strcmp( argv[1], "demo" ) == 0 )
+    {
+        show_demo( (GdkNativeWindow)atoi( argv[2] ) );
+        gtk_main();
+        return 0;
+    }
 
-  dlg = create_dlg ();
-  main_dlg_init( dlg );
-  gtk_widget_show (dlg);
+    dlg = create_dlg ();
+    main_dlg_init( dlg );
+    gtk_widget_show (dlg);
 
-  gtk_main ();
-  return 0;
+    gtk_main ();
+    return 0;
 }