widget-factory: Add tab close buttons
authorMatthias Clasen <mclasen@redhat.com>
Mon, 16 Mar 2015 02:42:44 +0000 (22:42 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 16 Mar 2015 02:44:33 +0000 (22:44 -0400)
This will make it easier to fix issues with such buttons
in HighContrast.

demos/widget-factory/Makefile.am
demos/widget-factory/widget-factory.c
demos/widget-factory/widget-factory.css [new file with mode: 0644]
demos/widget-factory/widget-factory.gresource.xml
demos/widget-factory/widget-factory.ui

index 2436798a43ca18f069145b636f5c791a04e2c740..9c057ff8bcfc6c50e7595443b85aa97ff7cf0830 100644 (file)
@@ -62,6 +62,7 @@ uninstall-update-icon-cache:
 
 EXTRA_DIST +=                          \
        widget-factory.ui               \
+       widget-factory.css              \
        menus.ui                        \
        widget-factory.gresource.xml    \
        data/source.svg                 \
index 4a6c92fd7153b3c503d53b5e9f7c8ec9960edb60..14c5f04660beebf0868ca1a2447709b70aa66791 100644 (file)
@@ -1157,7 +1157,7 @@ activate (GApplication *app)
   g_type_ensure (my_text_view_get_type ());
 
   provider = gtk_css_provider_new ();
-  gtk_css_provider_load_from_data (provider, ".circular-button { border-radius: 20px; outline-radius: 20px; }", -1, NULL);
+  gtk_css_provider_load_from_resource (provider, "/org/gtk/WidgetFactory/widget-factory.css");
   gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
                                              GTK_STYLE_PROVIDER (provider),
                                              GTK_STYLE_PROVIDER_PRIORITY_USER);
diff --git a/demos/widget-factory/widget-factory.css b/demos/widget-factory/widget-factory.css
new file mode 100644 (file)
index 0000000..3830ce5
--- /dev/null
@@ -0,0 +1,9 @@
+.circular-button {
+  border-radius: 20px;
+  outline-radius: 20px;
+}
+
+.small-button {
+  padding: 0;
+  outline-width: 0;
+}
index 7260e29e90859d8936ffc2d11783a5ddbd90545e..0a051e5c821816c66466615d8880658242d997fc 100644 (file)
@@ -3,6 +3,9 @@
   <gresource prefix="/org/gtk/WidgetFactory">
     <file preprocess="xml-stripblanks">widget-factory.ui</file>
   </gresource>
+  <gresource prefix="/org/gtk/WidgetFactory">
+    <file>widget-factory.css</file>
+  </gresource>
   <gresource prefix="/org/gtk/WidgetFactory/gtk">
     <file preprocess="xml-stripblanks">menus.ui</file>
   </gresource>
index a9ac2c7d104243faa59b86cf5bff17d161fa0ac6..6657a6537b4d6934bb651d7fb1ebe858536cf54c 100644 (file)
@@ -3857,11 +3857,41 @@ microphone-sensitivity-medium-symbolic</property>
                                         <property name="visible">True</property>
                                         <property name="height-request">120</property>
                                       </object>
+                                      <packing>
+                                        <property name="tab-expand">True</property>
+                                        <property name="tab-fill">True</property>
+                                      </packing>
                                     </child>
                                     <child type="tab">
-                                      <object class="GtkLabel">
+                                      <object class="GtkBox">
                                         <property name="visible">True</property>
-                                        <property name="label" translatable="yes">Page 1</property>
+                                        <property name="orientation">horizontal</property>
+                                        <child type="center">
+                                          <object class="GtkLabel">
+                                            <property name="visible">True</property>
+                                            <property name="label" translatable="yes">Page 1</property>
+                                          </object>
+                                        </child>
+                                        <child>
+                                          <object class="GtkButton">
+                                            <property name="visible">True</property>
+                                            <property name="relief">none</property>
+                                            <property name="focus-on-click">False</property>
+                                            <style>
+                                              <class name="small-button"/>
+                                            </style>
+                                            <child>
+                                              <object class="GtkImage">
+                                                <property name="visible">True</property>
+                                                <property name="icon-name">window-close-symbolic</property>
+                                                <property name="icon-size">1</property>
+                                              </object>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="pack-type">end</property>
+                                          </packing>
+                                        </child>
                                       </object>
                                     </child>
                                     <child>
@@ -3869,11 +3899,41 @@ microphone-sensitivity-medium-symbolic</property>
                                         <property name="visible">True</property>
                                         <property name="vexpand">True</property>
                                       </object>
+                                      <packing>
+                                        <property name="tab-expand">True</property>
+                                        <property name="tab-fill">True</property>
+                                      </packing>
                                     </child>
                                     <child type="tab">
-                                      <object class="GtkLabel">
+                                      <object class="GtkBox">
                                         <property name="visible">True</property>
-                                        <property name="label" translatable="yes">Page 2</property>
+                                        <property name="orientation">horizontal</property>
+                                        <child type="center">
+                                          <object class="GtkLabel">
+                                            <property name="visible">True</property>
+                                            <property name="label" translatable="yes">Page 2</property>
+                                          </object>
+                                        </child>
+                                        <child>
+                                          <object class="GtkButton">
+                                            <property name="visible">True</property>
+                                            <property name="relief">none</property>
+                                            <property name="focus-on-click">False</property>
+                                            <style>
+                                              <class name="small-button"/>
+                                            </style>
+                                            <child>
+                                              <object class="GtkImage">
+                                                <property name="visible">True</property>
+                                                <property name="icon-name">window-close-symbolic</property>
+                                                <property name="icon-size">1</property>
+                                              </object>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="pack-type">end</property>
+                                          </packing>
+                                        </child>
                                       </object>
                                     </child>
                                   </object>