diff options
author | Ken VanDine <ken.vandine@canonical.com> | 2011-12-14 13:29:26 -0500 |
---|---|---|
committer | Ken VanDine <ken.vandine@canonical.com> | 2011-12-14 13:29:26 -0500 |
commit | 97ead2117550eb6092676bcbeda633bb55c71ebb (patch) | |
tree | 1c3ced03cd9ec27f3406099e33cfb6892aa7ee2e | |
parent | 50b234a41b70db8f4c8b15ddaf2d15beacb602d6 (diff) | |
parent | 9b717e50b0890d938cd2cf6bb4ec938240740f31 (diff) | |
download | ayatana-ido-97ead2117550eb6092676bcbeda633bb55c71ebb.tar.gz ayatana-ido-97ead2117550eb6092676bcbeda633bb55c71ebb.tar.bz2 ayatana-ido-97ead2117550eb6092676bcbeda633bb55c71ebb.zip |
removed deprecations from gtk3 and fixed sizing issues with idemessagedialog (LP: #888392)
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | example/menus.c | 6 | ||||
-rw-r--r-- | example/messagedialog.c | 6 | ||||
-rw-r--r-- | src/idocalendarmenuitem.c | 6 | ||||
-rw-r--r-- | src/idoentrymenuitem.c | 6 | ||||
-rw-r--r-- | src/idomessagedialog.c | 17 | ||||
-rw-r--r-- | src/idorange.c | 2 | ||||
-rw-r--r-- | src/idoscalemenuitem.c | 14 |
8 files changed, 58 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 9026ab0..b56a9de 100644 --- a/configure.ac +++ b/configure.ac @@ -139,6 +139,7 @@ echo " ido $VERSION" echo " ===============================" echo "" echo " Prefix : ${prefix}" +echo " GTK : ${with_gtk}" echo "" echo " Documentation: ${enable_gtk_doc}" echo "" diff --git a/example/menus.c b/example/menus.c index d3a5f3f..b563eaf 100644 --- a/example/menus.c +++ b/example/menus.c @@ -3,6 +3,7 @@ #include "idoscalemenuitem.h" #include "idocalendarmenuitem.h" #include "idoentrymenuitem.h" +#include "config.h" static void slider_grabbed (GtkWidget *widget, gpointer user_data) @@ -37,7 +38,12 @@ main (int argc, char *argv[]) g_signal_connect (window, "delete-event", G_CALLBACK (gtk_main_quit), NULL); +#ifdef USE_GTK3 + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); +#else vbox = gtk_vbox_new (FALSE, 0); +#endif + gtk_container_add (GTK_CONTAINER (window), vbox); menubar = gtk_menu_bar_new (); diff --git a/example/messagedialog.c b/example/messagedialog.c index bc24aff..4ba866b 100644 --- a/example/messagedialog.c +++ b/example/messagedialog.c @@ -1,6 +1,7 @@ #include <gtk/gtk.h> #include "idomessagedialog.h" +#include "config.h" static void response_cb (GtkDialog *dialog, @@ -40,7 +41,12 @@ main (int argc, char *argv[]) gtk_window_set_title (GTK_WINDOW (window), "Message Dialogs"); g_signal_connect (window, "destroy", gtk_main_quit, NULL); +#ifdef USE_GTK3 + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); +#else vbox = gtk_vbox_new (FALSE, 0); +#endif + gtk_container_add (GTK_CONTAINER (window), vbox); button = gtk_button_new_with_label ("Confirmation dialog"); diff --git a/src/idocalendarmenuitem.c b/src/idocalendarmenuitem.c index 40d96a1..da7c436 100644 --- a/src/idocalendarmenuitem.c +++ b/src/idocalendarmenuitem.c @@ -25,6 +25,7 @@ #include <gdk/gdkkeysyms.h> #include "idocalendarmenuitem.h" +#include "config.h" #if GTK_CHECK_VERSION (3, 0, 0) static void ido_calendar_menu_item_select (GtkMenuItem *item); @@ -131,7 +132,12 @@ ido_calendar_menu_item_init (IdoCalendarMenuItem *item) G_CALLBACK (calendar_move_focus_cb), item); +#ifdef USE_GTK3 + priv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else priv->box = gtk_hbox_new (FALSE, 0); +#endif + gtk_box_pack_start (GTK_BOX (priv->box), priv->calendar, FALSE, FALSE, 0); gtk_container_add (GTK_CONTAINER (item), priv->box); diff --git a/src/idoentrymenuitem.c b/src/idoentrymenuitem.c index 1636da9..088c559 100644 --- a/src/idoentrymenuitem.c +++ b/src/idoentrymenuitem.c @@ -25,6 +25,7 @@ #include <gdk/gdkkeysyms.h> #include "idoentrymenuitem.h" +#include "config.h" #if GTK_CHECK_VERSION (3, 0, 0) static void ido_entry_menu_item_select (GtkMenuItem *item); @@ -118,7 +119,12 @@ ido_entry_menu_item_init (IdoEntryMenuItem *item) G_CALLBACK (entry_move_focus_cb), item); +#ifdef USE_GTK3 + priv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else priv->box = gtk_hbox_new (FALSE, 0); +#endif + gtk_box_pack_start (GTK_BOX (priv->box), priv->entry, FALSE, FALSE, 0); gtk_container_add (GTK_CONTAINER (item), priv->box); diff --git a/src/idomessagedialog.c b/src/idomessagedialog.c index 9b5fe2c..d4a3e2f 100644 --- a/src/idomessagedialog.c +++ b/src/idomessagedialog.c @@ -32,6 +32,7 @@ #include "idomessagedialog.h" #include "idotimeline.h" +#include "config.h" #define IDO_MESSAGE_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), IDO_TYPE_MESSAGE_DIALOG, IdoMessageDialogPrivate)) @@ -166,14 +167,22 @@ ido_message_dialog_focus_in_event (GtkWidget *widget, IdoTimeline *timeline; IdoMessageDialogMorphContext *context; +#ifdef USE_GTK3 + gtk_widget_get_preferred_size (GTK_WIDGET (dialog), NULL, &start); +#else gtk_widget_get_requisition (GTK_WIDGET (dialog), &start); +#endif priv->expanded = TRUE; gtk_widget_show (priv->action_area); gtk_widget_show (priv->secondary_label); +#ifdef USE_GTK3 + gtk_widget_get_preferred_size (GTK_WIDGET (dialog), NULL, &end); +#else gtk_widget_get_requisition (GTK_WIDGET (dialog), &end); +#endif gtk_widget_hide (priv->action_area); gtk_widget_hide (priv->secondary_label); @@ -370,7 +379,11 @@ ido_message_dialog_get_label (IdoMessageDialog *dialog, gboolean primary) for (list = children; list != NULL; list = list->next) { +#ifdef USE_GTK3 + if (G_TYPE_FROM_INSTANCE (list->data) == GTK_TYPE_BOX && gtk_orientable_get_orientation (list->data) == GTK_ORIENTATION_HORIZONTAL) +#else if (G_TYPE_FROM_INSTANCE (list->data) == GTK_TYPE_HBOX) +#endif { GList *hchildren; GList *hlist; @@ -380,7 +393,11 @@ ido_message_dialog_get_label (IdoMessageDialog *dialog, gboolean primary) for (hlist = hchildren; hlist != NULL; hlist = hlist->next) { +#ifdef USE_GTK3 + if (G_TYPE_FROM_INSTANCE (hlist->data) == GTK_TYPE_BOX && gtk_orientable_get_orientation (hlist->data) == GTK_ORIENTATION_VERTICAL) +#else if (G_TYPE_FROM_INSTANCE (hlist->data) == GTK_TYPE_VBOX) +#endif { GList *vlist; GtkWidget *vbox = GTK_WIDGET (hlist->data); diff --git a/src/idorange.c b/src/idorange.c index 83ab14b..7d7ee85 100644 --- a/src/idorange.c +++ b/src/idorange.c @@ -177,6 +177,7 @@ ido_range_constructed (GObject *object) "knob-height", &height, NULL); +#ifndef USE_GTK3 g_snprintf (buf, sizeof (buf), "style \"ido-range\" {\n" " GtkRange::slider-width = %d\n" @@ -184,6 +185,7 @@ ido_range_constructed (GObject *object) "} widget \"*.idorange-%p\" style \"ido-range\"\n", width, height, range); gtk_rc_parse_string (buf); +#endif } gtk_range_set_slider_size_fixed (GTK_RANGE (range), TRUE); diff --git a/src/idoscalemenuitem.c b/src/idoscalemenuitem.c index b7c93b7..f973f52 100644 --- a/src/idoscalemenuitem.c +++ b/src/idoscalemenuitem.c @@ -157,16 +157,26 @@ ido_scale_menu_item_size_allocate (GtkWidget *widget, switch (priv->style) { case IDO_SCALE_MENU_ITEM_STYLE_IMAGE: +#ifdef USE_GTK3 + gtk_widget_get_preferred_size (priv->primary_image, &primary_req, NULL); + gtk_widget_get_preferred_size (priv->secondary_image, &secondary_req, NULL); +#else gtk_widget_get_child_requisition (priv->primary_image, &primary_req); gtk_widget_get_child_requisition (priv->secondary_image, &secondary_req); +#endif primary_padding = gtk_widget_get_visible (priv->primary_image) ? primary_req.width : 0; secondary_padding = gtk_widget_get_visible (priv->secondary_image) ? secondary_req.width : 0; break; case IDO_SCALE_MENU_ITEM_STYLE_LABEL: +#ifdef USE_GTK3 + gtk_widget_get_preferred_size (priv->primary_label, &primary_req, NULL); + gtk_widget_get_preferred_size (priv->secondary_label, &secondary_req, NULL); +#else gtk_widget_get_child_requisition (priv->primary_label, &primary_req); gtk_widget_get_child_requisition (priv->secondary_label, &secondary_req); +#endif primary_padding = gtk_widget_get_visible (priv->primary_label) ? primary_req.width : 0; secondary_padding = gtk_widget_get_visible (priv->secondary_label) ? secondary_req.width : 0; @@ -247,7 +257,11 @@ ido_scale_menu_item_constructed (GObject *object) gtk_container_add (GTK_CONTAINER (priv->proxy), priv->scale); #endif +#ifdef USE_GTK3 + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else hbox = gtk_hbox_new (FALSE, 0); +#endif priv->primary_image = gtk_image_new (); g_signal_connect (priv->primary_image, "notify", |