aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-12-14 12:19:26 -0500
committerKen VanDine <ken.vandine@canonical.com>2011-12-14 12:19:26 -0500
commit9b717e50b0890d938cd2cf6bb4ec938240740f31 (patch)
tree1c3ced03cd9ec27f3406099e33cfb6892aa7ee2e /src
parent50b234a41b70db8f4c8b15ddaf2d15beacb602d6 (diff)
downloadayatana-ido-9b717e50b0890d938cd2cf6bb4ec938240740f31.tar.gz
ayatana-ido-9b717e50b0890d938cd2cf6bb4ec938240740f31.tar.bz2
ayatana-ido-9b717e50b0890d938cd2cf6bb4ec938240740f31.zip
removed deprecations from gtk3 and fixed sizing issues with idemessagedialog (LP: #888392)
Diffstat (limited to 'src')
-rw-r--r--src/idocalendarmenuitem.c6
-rw-r--r--src/idoentrymenuitem.c6
-rw-r--r--src/idomessagedialog.c17
-rw-r--r--src/idorange.c2
-rw-r--r--src/idoscalemenuitem.c14
5 files changed, 45 insertions, 0 deletions
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",