summaryrefslogtreecommitdiffstats
path: root/src/widgets/shrink-wrap-button.cpp
diff options
context:
space:
mode:
authorMartin Owens <doctormo@gmail.com>2014-03-27 01:33:44 +0000
committerMartin Owens <doctormo@gmail.com>2014-03-27 01:33:44 +0000
commit5a4fb2325f60d292b47330f540b26a3279341c90 (patch)
treed2aa7967be25450b83e625025366c618101ae49f /src/widgets/shrink-wrap-button.cpp
parentThe Polar Arrange Tab of the Arrange Dialog now hides the parametric (diff)
parentRemove Snap menu item and improve grid menu item text (diff)
downloadinkscape-5a4fb2325f60d292b47330f540b26a3279341c90.tar.gz
inkscape-5a4fb2325f60d292b47330f540b26a3279341c90.zip
Commit a merge to trunk, with probabal errors
(bzr r11073.1.36)
Diffstat (limited to 'src/widgets/shrink-wrap-button.cpp')
-rw-r--r--src/widgets/shrink-wrap-button.cpp47
1 files changed, 28 insertions, 19 deletions
diff --git a/src/widgets/shrink-wrap-button.cpp b/src/widgets/shrink-wrap-button.cpp
index 8d5bad21c..3558780ed 100644
--- a/src/widgets/shrink-wrap-button.cpp
+++ b/src/widgets/shrink-wrap-button.cpp
@@ -9,40 +9,49 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H
+#include <glibmm/threads.h>
+#endif
+
#include <gtkmm/button.h>
#include <gtk/gtk.h>
+#include "shrink-wrap-button.h"
+
namespace Inkscape {
namespace Widgets {
-namespace {
+void shrink_wrap_button(Gtk::Button &button) {
+ button.set_border_width(0);
+ button.set_can_focus(false);
+ button.set_can_default(false);
-void minimum_size(GtkWidget *widget, GtkRequisition *requisition, void *) {
- GtkWidget *child(gtk_bin_get_child(GTK_BIN(widget)));
+ Gtk::Widget* child = button.get_child();
+ Gtk::Requisition req_min;
if (child) {
-#if GTK_CHECK_VERSION(3,0,0)
- gtk_widget_get_preferred_size(child, requisition, NULL);
+#if WITH_GTKMM_3_0
+ Gtk::Requisition req_nat;
+ child->get_preferred_size(req_min, req_nat);
#else
- gtk_widget_size_request(child, requisition);
+ req_min = child->size_request();
#endif
} else {
- requisition->width = 0;
- requisition->height = 0;
+ req_min.width = 0;
+ req_min.height = 0;
}
- requisition->width += 2 + 2 * std::max(2, widget->style->xthickness);
- requisition->height += 2 + 2 * std::max(2, widget->style->ythickness);
-}
-
-}
+ // TODO: Use Gtk::StyleContext instead
+ GtkStyle* style = gtk_widget_get_style(GTK_WIDGET(button.gobj()));
+
+ req_min.width += 2 + 2 * std::max(2, style->xthickness);
+ req_min.height += 2 + 2 * std::max(2, style->ythickness);
-void shrink_wrap_button(Gtk::Button &button) {
- button.set_border_width(0);
- button.set_can_focus(false);
- button.set_can_default(false);
- g_signal_connect_after(G_OBJECT(button.gobj()), "size_request",
- G_CALLBACK(minimum_size), NULL);
+ button.set_size_request(req_min.width, req_min.height);
}
}