]> saetta.ns0.it Git - libgtkform/commitdiff
Too much padding on button under win32.
authorAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Fri, 4 Jul 2014 10:52:57 +0000 (12:52 +0200)
committerAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Fri, 4 Jul 2014 10:52:57 +0000 (12:52 +0200)
libgtkformui/gtkformdecoder.c

index a1f62498473628bfbf4b12a13aa2b59cce63c9ed..428217c2dea14c43b0da6d83e77baf4f95791971 100644 (file)
@@ -251,6 +251,11 @@ gtk_form_decoder_init (GtkFormDecoder *decoder)
 
        GtkWidget *icon;
 
+#ifdef G_OS_WIN32
+       GtkStyleContext *context;
+       GtkCssProvider *provider;
+#endif
+
        priv->hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 1);
        gtk_container_add (GTK_CONTAINER (decoder), priv->hbox);
        gtk_widget_show (priv->hbox);
@@ -263,6 +268,14 @@ gtk_form_decoder_init (GtkFormDecoder *decoder)
        g_signal_connect (G_OBJECT (priv->txt_decoded), "icon-press",
                          G_CALLBACK (gtk_form_decoder_on_btn_clean_clicked), (gpointer)decoder);
 
+#ifdef G_OS_WIN32
+       provider = gtk_css_provider_new ();
+       gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (provider),
+                                        ".button {\n"
+                                        "padding: 0px;\n"
+                                        "}\n", -1, NULL);
+#endif
+
        priv->btn_new = gtk_button_new ();
        gtk_widget_set_tooltip_text (priv->btn_new, _("New"));
        gtk_box_pack_start (GTK_BOX (priv->hbox), priv->btn_new, FALSE, FALSE, 0);
@@ -271,6 +284,13 @@ gtk_form_decoder_init (GtkFormDecoder *decoder)
        gtk_container_add (GTK_CONTAINER (priv->btn_new), icon);
        gtk_widget_show (icon);
 
+#ifdef G_OS_WIN32
+       context = gtk_widget_get_style_context (priv->btn_new);
+       gtk_style_context_add_provider (context,
+                                       GTK_STYLE_PROVIDER (provider),
+                                       GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+#endif
+
        g_signal_connect (G_OBJECT (priv->btn_new), "clicked",
                          G_CALLBACK (gtk_form_decoder_on_btn_new_clicked), (gpointer)decoder);
 
@@ -282,6 +302,13 @@ gtk_form_decoder_init (GtkFormDecoder *decoder)
        gtk_container_add (GTK_CONTAINER (priv->btn_open), icon);
        gtk_widget_show (icon);
 
+#ifdef G_OS_WIN32
+       context = gtk_widget_get_style_context (priv->btn_open);
+       gtk_style_context_add_provider (context,
+                                       GTK_STYLE_PROVIDER (provider),
+                                       GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+#endif
+
        g_signal_connect (G_OBJECT (priv->btn_open), "clicked",
                          G_CALLBACK (gtk_form_decoder_on_btn_open_clicked), (gpointer)decoder);
 
@@ -294,6 +321,13 @@ gtk_form_decoder_init (GtkFormDecoder *decoder)
        gtk_widget_show (icon);
        gtk_widget_show (priv->btn_browse);
 
+#ifdef G_OS_WIN32
+       context = gtk_widget_get_style_context (priv->btn_browse);
+       gtk_style_context_add_provider (context,
+                                       GTK_STYLE_PROVIDER (provider),
+                                       GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+#endif
+
        g_signal_connect (G_OBJECT (priv->btn_browse), "clicked",
                          G_CALLBACK (gtk_form_decoder_on_btn_browse_clicked), (gpointer)decoder);
 
@@ -301,6 +335,10 @@ gtk_form_decoder_init (GtkFormDecoder *decoder)
        gtk_box_pack_start (GTK_BOX (priv->hbox), priv->lbl_key, FALSE, FALSE, 0);
        gtk_widget_set_no_show_all (priv->lbl_key, TRUE);
 
+#ifdef G_OS_WIN32
+       g_object_unref (provider);
+#endif
+
        priv->completion_dm = NULL;
        priv->completion_key_column = 0;
        priv->completion_text_column = 0;