[gtk+] widget-factory: Add tab close buttons



commit de239ca31b93e8342ce980880da296555895e8ac
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 15 22:42:44 2015 -0400

    widget-factory: Add tab close buttons
    
    This will make it easier to fix issues with such buttons
    in HighContrast.

 demos/widget-factory/Makefile.am                  |    1 +
 demos/widget-factory/widget-factory.c             |    2 +-
 demos/widget-factory/widget-factory.css           |    9 +++
 demos/widget-factory/widget-factory.gresource.xml |    3 +
 demos/widget-factory/widget-factory.ui            |   68 +++++++++++++++++++-
 5 files changed, 78 insertions(+), 5 deletions(-)
---
diff --git a/demos/widget-factory/Makefile.am b/demos/widget-factory/Makefile.am
index 2436798..9c057ff 100644
--- a/demos/widget-factory/Makefile.am
+++ b/demos/widget-factory/Makefile.am
@@ -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                 \
diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c
index 4a6c92f..14c5f04 100644
--- a/demos/widget-factory/widget-factory.c
+++ b/demos/widget-factory/widget-factory.c
@@ -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
index 0000000..3830ce5
--- /dev/null
+++ b/demos/widget-factory/widget-factory.css
@@ -0,0 +1,9 @@
+.circular-button {
+  border-radius: 20px;
+  outline-radius: 20px;
+}
+
+.small-button {
+  padding: 0;
+  outline-width: 0;
+}
diff --git a/demos/widget-factory/widget-factory.gresource.xml 
b/demos/widget-factory/widget-factory.gresource.xml
index 7260e29..0a051e5 100644
--- a/demos/widget-factory/widget-factory.gresource.xml
+++ b/demos/widget-factory/widget-factory.gresource.xml
@@ -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>
diff --git a/demos/widget-factory/widget-factory.ui b/demos/widget-factory/widget-factory.ui
index a9ac2c7..6657a65 100644
--- a/demos/widget-factory/widget-factory.ui
+++ b/demos/widget-factory/widget-factory.ui
@@ -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>


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