[gthumb: 3/57] use accessor functions available in gtk 2.18



commit 464ae28911bfeedf178768a9b3139686e822402c
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Fri Jun 4 10:09:50 2010 +0200

    use accessor functions available in gtk 2.18

 gthumb/gedit-message-area.c |   25 ++++++++++++-------------
 gthumb/gth-browser.c        |   39 +++++++++++++++++++++------------------
 2 files changed, 33 insertions(+), 31 deletions(-)
---
diff --git a/gthumb/gedit-message-area.c b/gthumb/gedit-message-area.c
index 592d98d..76ea5ce 100644
--- a/gthumb/gedit-message-area.c
+++ b/gthumb/gedit-message-area.c
@@ -150,14 +150,14 @@ paint_message_area (GtkWidget      *widget,
 	guint        border;
 	GdkRectangle area;
 	GdkRectangle paint_area;
-	
+
 	border = gtk_container_get_border_width (GTK_CONTAINER (widget));
-	
+
 	area.x = widget->allocation.x + border;
 	area.y = widget->allocation.y + border;
 	area.width = widget->allocation.width - (border * 2);
 	area.height = widget->allocation.height - (border * 2);
-	
+
 	if (gdk_rectangle_intersect (&event->area, &area, &paint_area))
 		gtk_paint_flat_box (widget->style,
 				    widget->window,
@@ -384,7 +384,7 @@ gedit_message_area_set_contents	(GeditMessageArea *message_area,
  * @message_area: a #GeditMessageArea
  * @button_text: text of button, or stock ID
  * @response_id: response ID for the button
- * 
+ *
  * Adds a button with the given text (or a stock button, if button_text is a stock ID)
  * and sets things up so that clicking the button will emit the "response" signal
  * with the given response_id. The button is appended to the end of the message area's
@@ -404,7 +404,7 @@ gedit_message_area_add_button (GeditMessageArea *message_area,
 
 	button = gtk_button_new_from_stock (button_text);
 	gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
-	GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+	gtk_widget_set_can_default (button, TRUE);
 
 	gtk_widget_show (button);
 
@@ -473,9 +473,9 @@ gedit_message_area_add_buttons (GeditMessageArea *message_area,
 
 /**
  * gedit_message_area_new:
- * 
+ *
  * Creates a new #GeditMessageArea object.
- * 
+ *
  * Returns: a new #GeditMessageArea object
  */
 GtkWidget *
@@ -488,11 +488,11 @@ gedit_message_area_new (void)
  * gedit_message_area_new_with_buttons:
  * @first_button_text: stock ID or text to go in first button, or NULL
  * @...: response ID for first button, then additional buttons, ending with NULL
- * 
- * Creates a new #GeditMessageArea with buttons. Button text/response ID pairs 
+ *
+ * Creates a new #GeditMessageArea with buttons. Button text/response ID pairs
  * should be listed, with a NULL pointer ending the list. Button text can be either
  * a stock ID such as GTK_STOCK_OK, or some arbitrary text. A response ID can be any
- * positive number, or one of the values in the GtkResponseType enumeration. If 
+ * positive number, or one of the values in the GtkResponseType enumeration. If
  * the user clicks one of these dialog buttons, GeditMessageArea will emit the "response"
  * signal with the corresponding response ID.
  *
@@ -634,10 +634,9 @@ gedit_message_area_add_stock_button_with_text (GeditMessageArea *message_area,
 		gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON));
 	}
 	else
-		button = gtk_button_new_from_stock (stock_id);	
-        
-	GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+		button = gtk_button_new_from_stock (stock_id);
 
+	gtk_widget_set_can_default (button, TRUE);
 	gtk_widget_show (button);
 
 	gedit_message_area_add_action_widget (message_area,
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 88d1d38..2f021c0 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -1920,12 +1920,12 @@ _gth_browser_close_final_step (gpointer user_data)
 		gboolean       maximized;
 		GtkAllocation  allocation;
 
-		state = gdk_window_get_state (GTK_WIDGET (browser)->window);
+		state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (browser)));
 		maximized = (state & GDK_WINDOW_STATE_MAXIMIZED) != 0;
-		if (! maximized && GTK_WIDGET_VISIBLE (browser)) {
+		if (! maximized && gtk_widget_get_visible (GTK_WIDGET (browser))) {
 			int width, height;
 
-			gdk_drawable_get_size (GTK_WIDGET (browser)->window, &width, &height);
+			gdk_drawable_get_size (gtk_widget_get_window (GTK_WIDGET (browser)), &width, &height);
 			eel_gconf_set_integer (PREF_UI_WINDOW_WIDTH, width);
 			eel_gconf_set_integer (PREF_UI_WINDOW_HEIGHT, height);
 		}
@@ -2337,18 +2337,18 @@ folder_tree_drag_data_received (GtkWidget        *tree_view,
 				guint             time,
 				gpointer          user_data)
 {
-	GthBrowser   *browser = user_data;
-	gboolean      success = FALSE;
-	GtkTreePath  *path;
-	GthFileData  *destination;
-	char        **uris;
-	GList        *file_list;
+	GthBrowser     *browser = user_data;
+	gboolean        success = FALSE;
+	GdkDragAction   suggested_action;
+	GtkTreePath    *path;
+	GthFileData    *destination;
+	char          **uris;
+	GList          *file_list;
 
-	if ((context->suggested_action == GDK_ACTION_COPY)
-	    || (context->suggested_action == GDK_ACTION_MOVE))
-	{
+	suggested_action = context->suggested_action; /* gdk_drag_context_get_suggested_action (context) */
+
+	if ((suggested_action == GDK_ACTION_COPY) || (suggested_action == GDK_ACTION_MOVE))
 		success = TRUE;
-	}
 
 	if (! gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (browser->priv->folder_tree),
 						 x, y,
@@ -2367,7 +2367,7 @@ folder_tree_drag_data_received (GtkWidget        *tree_view,
 	uris = gtk_selection_data_get_uris (selection_data);
 	file_list = _g_file_list_new_from_uriv (uris);
 	if (file_list != NULL)
-		gth_hook_invoke ("gth-browser-folder-tree-drag-data-received", browser, destination, file_list, context->suggested_action);
+		gth_hook_invoke ("gth-browser-folder-tree-drag-data-received", browser, destination, file_list, suggested_action);
 
 	_g_object_list_unref (file_list);
 	g_strfreev (uris);
@@ -3366,9 +3366,12 @@ _gth_browser_set_sidebar_visibility  (GthBrowser *browser,
 
 	_gth_browser_set_action_active (browser, "View_Sidebar", visible);
 	if (visible) {
+		GtkAllocation allocation;
+
 		gtk_widget_show (browser->priv->browser_sidebar);
 		gtk_paned_set_position (GTK_PANED (browser->priv->browser_container), eel_gconf_get_integer (PREF_UI_BROWSER_SIDEBAR_WIDTH, DEF_SIDEBAR_WIDTH));
-		gtk_paned_set_position (GTK_PANED (browser->priv->browser_sidebar), browser->priv->browser_sidebar->allocation.height / 2);
+		gtk_widget_get_allocation (browser->priv->browser_sidebar, &allocation);
+		gtk_paned_set_position (GTK_PANED (browser->priv->browser_sidebar), allocation.height / 2);
 	}
 	else
 		gtk_widget_hide (browser->priv->browser_sidebar);
@@ -5266,12 +5269,12 @@ hide_mouse_pointer_cb (gpointer data)
 	int         px, py;
 	GList      *scan;
 
-	gdk_window_get_pointer (GTK_WIDGET (browser)->window, &px, &py, 0);
+	gdk_window_get_pointer (gtk_widget_get_window (GTK_WIDGET (browser)), &px, &py, 0);
 	for (scan = browser->priv->fullscreen_controls; scan; scan = scan->next) {
 		GtkWidget *widget = scan->data;
 		int        x, y, w, h;
 
-		gdk_window_get_geometry (widget->window, &x, &y, &w, &h, NULL);
+		gdk_window_get_geometry (gtk_widget_get_window (widget), &x, &y, &w, &h, NULL);
 
 		if ((px >= x) && (px <= x + w) && (py >= y) && (py <= y + h))
 			return FALSE;
@@ -5304,7 +5307,7 @@ fullscreen_motion_notify_event_cb (GtkWidget      *widget,
 	if ((abs (browser->priv->last_mouse_x - event->x) > MOTION_THRESHOLD)
 	    || (abs (browser->priv->last_mouse_y - event->y) > MOTION_THRESHOLD))
 	{
-		if (! GTK_WIDGET_VISIBLE (browser->priv->fullscreen_toolbar)) {
+		if (! gtk_widget_get_visible (browser->priv->fullscreen_toolbar)) {
 			GList *scan;
 
 			for (scan = browser->priv->fullscreen_controls; scan; scan = scan->next)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]