]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkrecentchooserdefault.c
gtk: remove "gboolean homogeneous" from gtk_box_new()
[~andy/gtk] / gtk / gtkrecentchooserdefault.c
index 612a8ec1df49866b0c65ffb0f0604d2d5536e2e1..f1caf17e26d2ed39ec56e5c1de94d5b7e5c09400 100644 (file)
@@ -41,7 +41,7 @@
 #include "gtkcellrenderertext.h"
 #include "gtkcheckmenuitem.h"
 #include "gtkclipboard.h"
-#include "gtkcombobox.h"
+#include "gtkcomboboxtext.h"
 #include "gtkentry.h"
 #include "gtkeventbox.h"
 #include "gtkexpander.h"
@@ -57,6 +57,7 @@
 #include "gtkscrolledwindow.h"
 #include "gtkseparatormenuitem.h"
 #include "gtksizegroup.h"
+#include "gtksizerequest.h"
 #include "gtktable.h"
 #include "gtktreemodelsort.h"
 #include "gtktreemodelfilter.h"
@@ -434,6 +435,7 @@ gtk_recent_chooser_default_constructor (GType                  type,
   gtk_tree_view_column_set_resizable (impl->icon_column, FALSE);
   
   renderer = gtk_cell_renderer_pixbuf_new ();
+  g_object_set (renderer, "stock-size", GTK_ICON_SIZE_BUTTON, NULL);
   gtk_tree_view_column_pack_start (impl->icon_column, renderer, FALSE);
   gtk_tree_view_column_set_cell_data_func (impl->icon_column,
                                           renderer,
@@ -471,9 +473,9 @@ gtk_recent_chooser_default_constructor (GType                  type,
                       GDK_ACTION_COPY);
   gtk_drag_source_add_uri_targets (impl->recent_view);
 
-  impl->filter_combo_hbox = gtk_hbox_new (FALSE, 12);
-  
-  impl->filter_combo = gtk_combo_box_new_text ();
+  impl->filter_combo_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+
+  impl->filter_combo = gtk_combo_box_text_new ();
   gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (impl->filter_combo), FALSE);
   g_signal_connect (impl->filter_combo, "changed",
                     G_CALLBACK (filter_combo_changed_cb), impl);
@@ -710,8 +712,9 @@ error_message_with_parent (GtkWindow   *parent,
   gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
                                            "%s", detail);
 
-  if (parent->group)
-    gtk_window_group_add_window (parent->group, GTK_WINDOW (dialog));
+  if (gtk_window_has_group (parent))
+    gtk_window_group_add_window (gtk_window_get_group (parent),
+                                 GTK_WINDOW (dialog));
 
   gtk_dialog_run (GTK_DIALOG (dialog));
   gtk_widget_destroy (dialog);
@@ -757,7 +760,8 @@ set_busy_cursor (GtkRecentChooserDefault *impl,
   if (show_busy_cursor)
     cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
 
-  gdk_window_set_cursor (GTK_WIDGET (toplevel)->window, cursor);
+  gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (toplevel)),
+                         cursor);
   gdk_display_flush (display);
 
   if (cursor)
@@ -936,20 +940,21 @@ set_default_size (GtkRecentChooserDefault *impl)
   widget = GTK_WIDGET (impl);
 
   /* Size based on characters and the icon size */
-  font_size = pango_font_description_get_size (widget->style->font_desc);
+  font_size = pango_font_description_get_size (gtk_widget_get_style (widget)->font_desc);
   font_size = PANGO_PIXELS (font_size);
 
   width = impl->icon_size + font_size * NUM_CHARS;
   height = (impl->icon_size + font_size) * NUM_LINES;
 
   /* Use at least the requisition size... */
-  gtk_widget_size_request (widget, &req);
+  gtk_widget_get_preferred_size (widget, &req, NULL);
   width = MAX (width, req.width);
   height = MAX (height, req.height);
 
   /* ... but no larger than the monitor */
   screen = gtk_widget_get_screen (widget);
-  monitor_num = gdk_screen_get_monitor_at_window (screen, widget->window);
+  monitor_num = gdk_screen_get_monitor_at_window (screen,
+                                                  gtk_widget_get_window (widget));
 
   gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
 
@@ -980,23 +985,17 @@ recent_icon_data_func (GtkTreeViewColumn *tree_column,
                       GtkTreeIter       *iter,
                       gpointer           user_data)
 {
-  GtkRecentChooserDefault *impl = GTK_RECENT_CHOOSER_DEFAULT (user_data);
   GtkRecentInfo *info = NULL;
-  GdkPixbuf *pixbuf;
-  
-  gtk_tree_model_get (model, iter,
-                      RECENT_INFO_COLUMN, &info,
-                      -1);
+  GIcon *icon;
+
+  gtk_tree_model_get (model, iter, RECENT_INFO_COLUMN, &info, -1);
   g_assert (info != NULL);
-  
-  pixbuf = gtk_recent_info_get_icon (info, impl->icon_size);
-  
-  g_object_set (cell,
-                "pixbuf", pixbuf,
-                NULL);
-  
-  if (pixbuf)  
-    g_object_unref (pixbuf);
+
+  icon = gtk_recent_info_get_gicon (info);
+  g_object_set (cell, "gicon", icon, NULL);
+
+  if (icon != NULL)
+    g_object_unref (icon);
 
   gtk_recent_info_unref (info);
 }
@@ -1296,9 +1295,9 @@ gtk_recent_chooser_default_add_filter (GtkRecentChooser *chooser,
   name = gtk_recent_filter_get_name (filter);
   if (!name)
     name = _("Untitled filter");
-    
-  gtk_combo_box_append_text (GTK_COMBO_BOX (impl->filter_combo), name);
-  
+
+  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (impl->filter_combo), name);
+
   if (!g_slist_find (impl->filters, impl->current_filter))
     set_current_filter (impl, filter);
   
@@ -1831,6 +1830,7 @@ popup_position_func (GtkMenu   *menu,
                      gboolean  *push_in,
                      gpointer  user_data)
 {
+  GtkAllocation allocation;
   GtkWidget *widget = GTK_WIDGET (user_data);
   GdkScreen *screen = gtk_widget_get_screen (widget);
   GtkRequisition req;
@@ -1840,12 +1840,15 @@ popup_position_func (GtkMenu   *menu,
   if (G_UNLIKELY (!gtk_widget_get_realized (widget)))
     return;
 
-  gdk_window_get_origin (widget->window, x, y);
+  gdk_window_get_origin (gtk_widget_get_window (widget),
+                         x, y);
 
-  gtk_widget_size_request (GTK_WIDGET (menu), &req);
+  gtk_widget_get_preferred_size (GTK_WIDGET (menu),
+                                 &req, NULL);
 
-  *x += (widget->allocation.width - req.width) / 2;
-  *y += (widget->allocation.height - req.height) / 2;
+  gtk_widget_get_allocation (widget, &allocation);
+  *x += (allocation.width - req.width) / 2;
+  *y += (allocation.height - req.height) / 2;
 
   monitor_num = gdk_screen_get_monitor_at_point (screen, *x, *y);
   gtk_menu_set_monitor (menu, monitor_num);