summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJasmine Hassan <[email protected]>2012-11-08 01:03:47 +0200
committerJasmine Hassan <[email protected]>2012-11-16 09:45:52 +0200
commit48d2f19ea2b821d1f3b3017afc912154ab2ee7da (patch)
tree599e2a5998d582176ca84f7abf30f88c600705fc /src
parente5b2fbf43e1c1ad5552abb004e5ebc4beb17ce2c (diff)
downloadcaja-48d2f19ea2b821d1f3b3017afc912154ab2ee7da.tar.bz2
caja-48d2f19ea2b821d1f3b3017afc912154ab2ee7da.tar.xz
[src] use gtk_widget_get_preferred_size()
http://git.gnome.org/browse/nautilus/commit/?id=c47d18f566fa9518ca7750922da7da66d3211f3e
Diffstat (limited to 'src')
-rw-r--r--src/caja-pathbar.c27
-rw-r--r--src/caja-side-pane.c8
-rw-r--r--src/caja-spatial-window.c8
-rw-r--r--src/caja-zoom-control.c8
4 files changed, 36 insertions, 15 deletions
diff --git a/src/caja-pathbar.c b/src/caja-pathbar.c
index b5504fc9..6a582014 100644
--- a/src/caja-pathbar.c
+++ b/src/caja-pathbar.c
@@ -39,6 +39,10 @@
#include "caja-window-private.h"
#include "caja-window-slot.h"
+#if !GTK_CHECK_VERSION(3,0,0)
+#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
+#endif
+
enum
{
PATH_CLICKED,
@@ -493,7 +497,8 @@ caja_path_bar_size_request (GtkWidget *widget,
for (list = path_bar->button_list; list; list = list->next)
{
button_data = BUTTON_DATA (list->data);
- gtk_widget_size_request (button_data->button, &child_requisition);
+ gtk_widget_get_preferred_size (button_data->button,
+ &child_requisition, NULL);
requisition->width = MAX (child_requisition.width, requisition->width);
requisition->height = MAX (child_requisition.height, requisition->height);
}
@@ -508,8 +513,10 @@ caja_path_bar_size_request (GtkWidget *widget,
requisition->width += (path_bar->spacing + path_bar->slider_width) * 2;
}
- gtk_widget_size_request (path_bar->up_slider_button, &child_requisition);
- gtk_widget_size_request (path_bar->down_slider_button, &child_requisition);
+ gtk_widget_get_preferred_size (path_bar->up_slider_button,
+ &child_requisition, NULL);
+ gtk_widget_get_preferred_size (path_bar->down_slider_button,
+ &child_requisition, NULL);
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
requisition->width += border_width * 2;
@@ -601,13 +608,14 @@ caja_path_bar_size_allocate (GtkWidget *widget,
width = 0;
}
- gtk_widget_get_child_requisition (BUTTON_DATA (path_bar->button_list->data)->button, &child_requisition);
+ gtk_widget_get_preferred_size (BUTTON_DATA (path_bar->button_list->data)->button,
+ &child_requisition, NULL);
width += child_requisition.width;
for (list = path_bar->button_list->next; list; list = list->next)
{
child = BUTTON_DATA (list->data)->button;
- gtk_widget_get_child_requisition (child, &child_requisition);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
width += child_requisition.width + path_bar->spacing;
if (list == path_bar->fake_root)
@@ -649,13 +657,14 @@ caja_path_bar_size_allocate (GtkWidget *widget,
* button, then count backwards.
*/
/* Count down the path chain towards the end. */
- gtk_widget_get_child_requisition (BUTTON_DATA (first_button->data)->button, &child_requisition);
+ gtk_widget_get_preferred_size (BUTTON_DATA (first_button->data)->button,
+ &child_requisition, NULL);
width = child_requisition.width;
list = first_button->prev;
while (list && !reached_end)
{
child = BUTTON_DATA (list->data)->button;
- gtk_widget_get_child_requisition (child, &child_requisition);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
if (width + child_requisition.width + path_bar->spacing + slider_space > allocation_width)
{
@@ -681,7 +690,7 @@ caja_path_bar_size_allocate (GtkWidget *widget,
while (first_button->next && ! reached_end)
{
child = BUTTON_DATA (first_button->next->data)->button;
- gtk_widget_get_child_requisition (child, &child_requisition);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
if (width + child_requisition.width + path_bar->spacing + slider_space > allocation_width)
{
@@ -725,7 +734,7 @@ caja_path_bar_size_allocate (GtkWidget *widget,
for (list = first_button; list; list = list->prev)
{
child = BUTTON_DATA (list->data)->button;
- gtk_widget_get_child_requisition (child, &child_requisition);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
gtk_widget_get_allocation (widget, &widget_allocation);
diff --git a/src/caja-side-pane.c b/src/caja-side-pane.c
index a5d6544e..d3922b9f 100644
--- a/src/caja-side-pane.c
+++ b/src/caja-side-pane.c
@@ -30,6 +30,10 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
+#if !GTK_CHECK_VERSION(3,0,0)
+#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
+#endif
+
typedef struct
{
char *title;
@@ -146,7 +150,7 @@ caja_side_pane_size_allocate (GtkWidget *widget,
frame = pane->details->title_frame;
hbox = pane->details->title_hbox;
- gtk_widget_get_child_requisition (hbox, &child_requisition);
+ gtk_widget_get_preferred_size (hbox, &child_requisition, NULL);
width = child_requisition.width;
gtk_widget_get_allocation (frame, &frame_allocation);
@@ -249,7 +253,7 @@ select_button_press_callback (GtkWidget *widget,
gtk_widget_get_allocation (widget, &allocation);
width = allocation.width;
gtk_widget_set_size_request (side_pane->details->menu, -1, -1);
- gtk_widget_size_request (side_pane->details->menu, &requisition);
+ gtk_widget_get_preferred_size (side_pane->details->menu, &requisition, NULL);
gtk_widget_set_size_request (side_pane->details->menu,
MAX (width, requisition.width), -1);
diff --git a/src/caja-spatial-window.c b/src/caja-spatial-window.c
index 161a3038..524fbb9b 100644
--- a/src/caja-spatial-window.c
+++ b/src/caja-spatial-window.c
@@ -64,6 +64,10 @@
#include <libcaja-private/caja-search-engine.h>
#include <libcaja-private/caja-signaller.h>
+#if !GTK_CHECK_VERSION(3,0,0)
+#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
+#endif
+
#define MAX_TITLE_LENGTH 180
#define MAX_SHORTNAME_PATH 16
@@ -632,8 +636,8 @@ menu_popup_pos (GtkMenu *menu,
widget = user_data;
- gtk_widget_size_request (GTK_WIDGET (menu), &menu_requisition);
- gtk_widget_size_request (widget, &button_requisition);
+ gtk_widget_get_preferred_size (GTK_WIDGET (menu), &menu_requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &button_requisition, NULL);
gtk_widget_get_allocation (widget, &allocation);
gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
diff --git a/src/caja-zoom-control.c b/src/caja-zoom-control.c
index 685242dc..1b251da2 100644
--- a/src/caja-zoom-control.c
+++ b/src/caja-zoom-control.c
@@ -44,6 +44,10 @@
#include <stdlib.h>
#include <string.h>
+#if !GTK_CHECK_VERSION(3,0,0)
+#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
+#endif
+
enum
{
ZOOM_IN,
@@ -153,8 +157,8 @@ menu_position_under_widget (GtkMenu *menu,
container = gtk_widget_get_ancestor (widget, GTK_TYPE_CONTAINER);
g_assert (container != NULL);
- gtk_widget_size_request (widget, &req);
- gtk_widget_size_request (GTK_WIDGET (menu), &menu_req);
+ gtk_widget_get_preferred_size (GTK_WIDGET (menu), &menu_req, NULL);
+ gtk_widget_get_preferred_size (widget, &req, NULL);
gtk_widget_get_allocation (widget, &allocation);
screen = gtk_widget_get_screen (GTK_WIDGET (menu));