Sophie

Sophie

distrib > Mandriva > 2007.1 > x86_64 > media > main-updates-src > by-pkgid > dd54318f2eca4df77d44de13d6fd0784 > files > 2

gtk+2.0-2.10.11-2.1mdv2007.1.src.rpm

Index: gtk/gtkfilechooserdefault.c
===================================================================
--- gtk+/gtk/gtkfilechooserdefault.c	(révision 17513)
+++ gtk+/gtk/gtkfilechooserdefault.c	(copie de travail)
@@ -7145,12 +7145,24 @@
   gint default_width, default_height;
   int font_size;
   GtkRequisition req;
+  GdkScreen *screen;
+  double resolution;
 
   g_assert (widget->style != NULL);
   impl = GTK_FILE_CHOOSER_DEFAULT (widget);
 
+  screen = gtk_widget_get_screen (widget);
+  if (screen)
+    {
+      resolution = gdk_screen_get_resolution (screen);
+      if (resolution < 0.0) /* will be -1 if the resolution is not defined in the GdkScreen */
+	resolution = 96.0;
+    }
+  else
+    resolution = 96.0; /* wheeee */
+
   font_size = pango_font_description_get_size (widget->style->font_desc);
-  font_size = PANGO_PIXELS (font_size);
+  font_size = PANGO_PIXELS (font_size) * resolution / 72.0;
 
   default_width = font_size * NUM_CHARS;
   default_height = font_size * NUM_LINES;
Index: gtk/gtkprintunixdialog.c
===================================================================
--- gtk+/gtk/gtkprintunixdialog.c	(révision 17513)
+++ gtk+/gtk/gtkprintunixdialog.c	(copie de travail)
@@ -415,6 +415,7 @@
   GtkPrintUnixDialogPrivate *priv = dialog->priv;
   GtkTreeIter iter, filter_iter;
   GtkTreeSelection *selection;
+  GtkTreePath *path;
 
   gtk_list_store_append (GTK_LIST_STORE (priv->printer_list), &iter);
   
@@ -434,7 +435,8 @@
 
   gtk_tree_model_filter_convert_child_iter_to_iter (priv->printer_list_filter,
 						    &filter_iter, &iter);
-  
+  path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->printer_list_filter), &filter_iter);
+
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->printer_treeview));
   
   if (priv->waiting_for_printer != NULL &&
@@ -443,6 +445,8 @@
     {
       priv->internal_printer_change = TRUE;
       gtk_tree_selection_select_iter (selection, &filter_iter);
+      gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (priv->printer_treeview),
+                                    path, NULL, TRUE, 0.5, 0.0);
       priv->internal_printer_change = FALSE;
       g_free (priv->waiting_for_printer);
       priv->waiting_for_printer = NULL;
@@ -452,8 +456,12 @@
     {
       priv->internal_printer_change = TRUE;
       gtk_tree_selection_select_iter (selection, &filter_iter);
+      gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (priv->printer_treeview),
+                                    path, NULL, TRUE, 0.5, 0.0);
       priv->internal_printer_change = FALSE;
     }
+
+  gtk_tree_path_free (path);
 }
 
 static void
Index: gtk/gtkicontheme.c
===================================================================
--- gtk+/gtk/gtkicontheme.c	(révision 17513)
+++ gtk+/gtk/gtkicontheme.c	(copie de travail)
@@ -73,6 +73,7 @@
   guint pixbuf_supports_svg : 1;
   guint themes_valid        : 1;
   guint check_reload        : 1;
+  guint loading_themes      : 1;
   
   char *current_theme;
   char *fallback_theme;
@@ -205,7 +206,8 @@
 				       char             *subdir);
 static void         do_theme_change   (GtkIconTheme     *icon_theme);
 
-static void  blow_themes               (GtkIconTheme    *icon_themes);
+static void     blow_themes               (GtkIconTheme    *icon_themes);
+static gboolean rescan_themes             (GtkIconTheme    *icon_themes);
 
 static void  icon_data_free            (GtkIconData     *icon_data);
 static void load_icon_data             (IconThemeDir    *dir,
@@ -1182,37 +1184,49 @@
   GTimeVal tv;
   gboolean was_valid = priv->themes_valid;
 
+  if (priv->loading_themes)
+    return;
+  priv->loading_themes = TRUE;
+
   _gtk_icon_theme_ensure_builtin_cache ();
 
   if (priv->themes_valid)
     {
       g_get_current_time (&tv);
 
-      if (ABS (tv.tv_sec - priv->last_stat_time) > 5)
-	gtk_icon_theme_rescan_if_needed (icon_theme);
+      if (ABS (tv.tv_sec - priv->last_stat_time) > 5 &&
+	  rescan_themes (icon_theme))
+	blow_themes (icon_theme);
     }
   
   if (!priv->themes_valid)
     {
       load_themes (icon_theme);
-      
-      if (!priv->check_reload && was_valid && priv->screen)
-	{	  
-	  static GdkAtom atom_iconthemes = GDK_NONE;
-	  GdkEvent *event = gdk_event_new (GDK_CLIENT_EVENT);
-	  int i;
 
-	  if (!atom_iconthemes)
-	    atom_iconthemes = gdk_atom_intern_static_string ("_GTK_LOAD_ICONTHEMES");
+      if (was_valid)
+	{
+	  g_signal_emit (icon_theme, signal_changed, 0);
 
-	  for (i = 0; i < 5; i++)
-	    event->client.data.l[i] = 0;
-	  event->client.data_format = 32;
-	  event->client.message_type = atom_iconthemes;
+	  if (!priv->check_reload && priv->screen)
+	    {	  
+	      static GdkAtom atom_iconthemes = GDK_NONE;
+	      GdkEvent *event = gdk_event_new (GDK_CLIENT_EVENT);
+	      int i;
 
-	  gdk_screen_broadcast_client_message (priv->screen, event);
+	      if (!atom_iconthemes)
+		atom_iconthemes = gdk_atom_intern_static_string ("_GTK_LOAD_ICONTHEMES");
+
+	      for (i = 0; i < 5; i++)
+		event->client.data.l[i] = 0;
+	      event->client.data_format = 32;
+	      event->client.message_type = atom_iconthemes;
+
+	      gdk_screen_broadcast_client_message (priv->screen, event);
+	    }
 	}
     }
+
+  priv->loading_themes = FALSE;
 }
 
 /**
@@ -1679,21 +1693,9 @@
   return NULL;
 }
 
-/**
- * gtk_icon_theme_rescan_if_needed:
- * @icon_theme: a #GtkIconTheme
- * 
- * Checks to see if the icon theme has changed; if it has, any
- * currently cached information is discarded and will be reloaded
- * next time @icon_theme is accessed.
- * 
- * Return value: %TRUE if the icon theme has changed and needed
- *   to be reloaded.
- *
- * Since: 2.4
- **/
-gboolean
-gtk_icon_theme_rescan_if_needed (GtkIconTheme *icon_theme)
+
+static gboolean
+rescan_themes (GtkIconTheme *icon_theme)
 {
   GtkIconThemePrivate *priv;
   IconThemeDirMtime *dir_mtime;
@@ -1702,10 +1704,8 @@
   struct stat stat_buf;
   GTimeVal tv;
 
-  g_return_val_if_fail (GTK_IS_ICON_THEME (icon_theme), FALSE);
+  priv = icon_theme->priv;
 
-  priv = icon_theme->priv;
-  
   for (d = priv->dir_mtimes; d != NULL; d = d->next)
     {
       dir_mtime = d->data;
@@ -1713,7 +1713,7 @@
       stat_res = g_stat (dir_mtime->dir, &stat_buf);
 
       /* dir mtime didn't change */
-      if (stat_res == 0 && 
+      if (stat_res == 0 &&
 	  S_ISDIR (stat_buf.st_mode) &&
 	  dir_mtime->mtime == stat_buf.st_mtime)
 	continue;
@@ -1721,17 +1721,43 @@
       if (dir_mtime->mtime == 0 &&
 	  (stat_res != 0 || !S_ISDIR (stat_buf.st_mode)))
 	continue;
-	  
-      do_theme_change (icon_theme);
+
       return TRUE;
     }
-  
+
   g_get_current_time (&tv);
   priv->last_stat_time = tv.tv_sec;
 
   return FALSE;
 }
 
+/**
+ * gtk_icon_theme_rescan_if_needed:
+ * @icon_theme: a #GtkIconTheme
+ * 
+ * Checks to see if the icon theme has changed; if it has, any
+ * currently cached information is discarded and will be reloaded
+ * next time @icon_theme is accessed.
+ * 
+ * Return value: %TRUE if the icon theme has changed and needed
+ *   to be reloaded.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gtk_icon_theme_rescan_if_needed (GtkIconTheme *icon_theme)
+{
+  gboolean retval;
+
+  g_return_val_if_fail (GTK_IS_ICON_THEME (icon_theme), FALSE);
+
+  retval = rescan_themes (icon_theme);
+  if (retval)
+      do_theme_change (icon_theme);
+
+  return retval;
+}
+
 static void
 theme_destroy (IconTheme *theme)
 {