]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkrecentchooserdefault.c
GtkApplication: Allow passing windows on non-X11 targets
[~andy/gtk] / gtk / gtkrecentchooserdefault.c
index 7adc1aebd6ae4dcd6e9d70e0e51cb685c8c8287c..2d15efee8531729192d0c69815f465a4db15a963 100644 (file)
@@ -13,9 +13,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "config.h"
@@ -74,8 +72,6 @@
 #include "gtkrecentchooserutils.h"
 #include "gtkrecentchooserdefault.h"
 
-#include "gtkprivate.h"
-
 
 enum 
 {
@@ -631,12 +627,8 @@ gtk_recent_chooser_default_dispose (GObject *object)
       impl->load_id = 0;
     }
 
-  if (impl->recent_items)
-    {
-      g_list_foreach (impl->recent_items, (GFunc) gtk_recent_info_unref, NULL);
-      g_list_free (impl->recent_items);
-      impl->recent_items = NULL;
-    }
+  g_list_free_full (impl->recent_items, (GDestroyNotify) gtk_recent_info_unref);
+  impl->recent_items = NULL;
 
   if (impl->manager && impl->manager_changed_id)
     {
@@ -841,10 +833,7 @@ load_recent_items (gpointer user_data)
       /* we have finished loading, so we remove the items cache */
       impl->load_state = LOAD_LOADING;
       
-      g_list_foreach (impl->recent_items,
-                     (GFunc) gtk_recent_info_unref,
-                     NULL);
-      g_list_free (impl->recent_items);
+      g_list_free_full (impl->recent_items, (GDestroyNotify) gtk_recent_info_unref);
       
       impl->recent_items = NULL;
       impl->n_recent_items = 0;
@@ -933,7 +922,7 @@ set_default_size (GtkRecentChooserDefault *impl)
   GtkScrolledWindow *scrollw;
   GtkWidget *widget;
   gint width, height;
-  gint font_size;
+  double font_size;
   GdkScreen *screen;
   gint monitor_num;
   GtkRequisition req;
@@ -946,11 +935,10 @@ set_default_size (GtkRecentChooserDefault *impl)
   state = gtk_widget_get_state_flags (widget);
 
   /* Size based on characters and the icon size */
-  font_size = pango_font_description_get_size (gtk_style_context_get_font (context, state));
-  font_size = PANGO_PIXELS (font_size);
+  gtk_style_context_get (context, state, "font-size", &font_size, NULL);
 
-  width = impl->icon_size + font_size * NUM_CHARS;
-  height = (impl->icon_size + font_size) * NUM_LINES;
+  width = impl->icon_size + font_size * NUM_CHARS + 0.5;
+  height = (impl->icon_size + font_size) * NUM_LINES + 0.5;
 
   /* Use at least the requisition size... */
   gtk_widget_get_preferred_size (widget, &req, NULL);
@@ -962,7 +950,7 @@ set_default_size (GtkRecentChooserDefault *impl)
   monitor_num = gdk_screen_get_monitor_at_window (screen,
                                                   gtk_widget_get_window (widget));
 
-  gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+  gdk_screen_get_monitor_workarea (screen, monitor_num, &monitor);
 
   width = MIN (width, monitor.width * 3 / 4);
   height = MIN (height, monitor.height * 3 / 4);
@@ -1860,7 +1848,7 @@ popup_position_func (GtkMenu   *menu,
 
   monitor_num = gdk_screen_get_monitor_at_point (screen, *x, *y);
   gtk_menu_set_monitor (menu, monitor_num);
-  gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+  gdk_screen_get_monitor_workarea (screen, monitor_num, &monitor);
 
   *x = CLAMP (*x, monitor.x, monitor.x + MAX (0, monitor.width - req.width));
   *y = CLAMP (*y, monitor.y, monitor.y + MAX (0, monitor.height - req.height));
@@ -1905,7 +1893,7 @@ recent_view_button_press_cb (GtkWidget      *widget,
 {
   GtkRecentChooserDefault *impl = GTK_RECENT_CHOOSER_DEFAULT (user_data);
 
-  if (_gtk_button_event_triggers_context_menu (event))
+  if (gdk_event_triggers_context_menu ((GdkEvent *) event))
     {
       GtkTreePath *path;
       gboolean res;