combined patches
- From: Frank Worsley <fworsley shaw ca>
- To: Alexander Larsson <alexl redhat com>
- Cc: David Watson <dwatson cs ucr edu>, Dave Bordoley <bordoley msu edu>, nautilus-list gnome org
- Subject: combined patches
- Date: Sun, 02 Jun 2002 18:39:19 -0700
Hi all,
here's a combined big patch for the font size and window size things. I
hope it is good to go now, I really want to get this in for 2.0.
Cheers,
- Frank
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.5356
diff -u -p -r1.5356 ChangeLog
--- ChangeLog 2002/06/02 04:06:17 1.5356
+++ ChangeLog 2002/06/03 01:41:46
@@ -1,3 +1,18 @@
+2002-06-02 Frank Worsley <fworsley shaw ca>
+
+ * src/file-manager/fm-icon-view.c:
+ * src/file-manager/fm-list-view.c:
+ always use the user selected font at default zoom
+ nice if you have a small/large default zoom so you
+ don't have a tiny/large font
+
+ * src/nautilus-application.c:
+ save the window geometry whenever a window is resized
+
+ * src/nautilus-window-manage-views.c:
+ always use the stored window geometry when
+ displaying a window
+
2002-06-01 David Emory Watson <dwatson cs ucr edu>
* libnautilus-private/apps_nautilus_preferences.schemas: Added schemas
Index: src/file-manager/fm-list-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-list-view.c,v
retrieving revision 1.174
diff -u -p -r1.174 fm-list-view.c
--- src/file-manager/fm-list-view.c 2002/05/21 09:43:37 1.174
+++ src/file-manager/fm-list-view.c 2002/06/03 01:41:46
@@ -80,6 +80,9 @@ static GList * fm_list_view
static void fm_list_view_set_zoom_level (FMListView *view,
NautilusZoomLevel new_level,
gboolean always_set_level);
+static void fm_list_view_scale_font_size (FMListView *view,
+ NautilusZoomLevel new_level,
+ gboolean update_size_table);
GNOME_CLASS_BOILERPLATE (FMListView, fm_list_view,
FMDirectoryView, FM_TYPE_DIRECTORY_VIEW)
@@ -411,6 +414,16 @@ set_sort_order_from_metadata_and_prefere
sort_reversed ? GTK_SORT_DESCENDING : GTK_SORT_ASCENDING);
}
+static gboolean
+list_view_changed_foreach (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ gtk_tree_model_row_changed (model, path, iter);
+ return FALSE;
+}
+
static void
set_zoom_level_from_metadata_and_preferences (FMListView *list_view)
{
@@ -423,6 +436,13 @@ set_zoom_level_from_metadata_and_prefere
NAUTILUS_METADATA_KEY_LIST_VIEW_ZOOM_LEVEL,
default_zoom_level_auto_value);
fm_list_view_set_zoom_level (list_view, level, TRUE);
+
+ /* reset the font size table for the new default zoom level */
+ fm_list_view_scale_font_size (list_view, level, TRUE);
+
+ /* updated the rows after updating the font size */
+ gtk_tree_model_foreach (GTK_TREE_MODEL (list_view->details->model),
+ list_view_changed_foreach, NULL);
}
}
@@ -553,17 +573,117 @@ fm_list_view_reset_to_defaults (FMDirect
}
static void
+fm_list_view_scale_font_size (FMListView *view,
+ NautilusZoomLevel new_level,
+ gboolean update_size_table)
+{
+ static gboolean first_time = TRUE;
+ static double pango_scale[7];
+
+ if (update_size_table || first_time) {
+ first_time = FALSE;
+
+ switch (default_zoom_level_auto_value)
+ {
+ case NAUTILUS_ZOOM_LEVEL_LARGEST:
+ pango_scale[0] = (1 / 1.2) * (1 / 1.2) * PANGO_SCALE_XX_SMALL;
+ pango_scale[1] = (1 / 1.2) * PANGO_SCALE_XX_SMALL;
+ pango_scale[2] = PANGO_SCALE_XX_SMALL;
+ pango_scale[3] = PANGO_SCALE_X_SMALL;
+ pango_scale[4] = PANGO_SCALE_SMALL;
+ pango_scale[5] = PANGO_SCALE_MEDIUM;
+ pango_scale[6] = PANGO_SCALE_LARGE;
+ break;
+ case NAUTILUS_ZOOM_LEVEL_LARGER:
+ pango_scale[0] = (1 / 1.2) * PANGO_SCALE_XX_SMALL;
+ pango_scale[1] = PANGO_SCALE_XX_SMALL;
+ pango_scale[2] = PANGO_SCALE_X_SMALL;
+ pango_scale[3] = PANGO_SCALE_SMALL;
+ pango_scale[4] = PANGO_SCALE_MEDIUM;
+ pango_scale[5] = PANGO_SCALE_LARGE;
+ pango_scale[6] = PANGO_SCALE_X_LARGE;
+ break;
+ case NAUTILUS_ZOOM_LEVEL_LARGE:
+ pango_scale[0] = PANGO_SCALE_XX_SMALL;
+ pango_scale[1] = PANGO_SCALE_X_SMALL;
+ pango_scale[2] = PANGO_SCALE_SMALL;
+ pango_scale[3] = PANGO_SCALE_MEDIUM;
+ pango_scale[4] = PANGO_SCALE_LARGE;
+ pango_scale[5] = PANGO_SCALE_X_LARGE;
+ pango_scale[6] = PANGO_SCALE_XX_LARGE;
+ break;
+ case NAUTILUS_ZOOM_LEVEL_STANDARD:
+ pango_scale[0] = PANGO_SCALE_X_SMALL;
+ pango_scale[1] = PANGO_SCALE_SMALL;
+ pango_scale[2] = PANGO_SCALE_MEDIUM;
+ pango_scale[3] = PANGO_SCALE_LARGE;
+ pango_scale[4] = PANGO_SCALE_X_LARGE;
+ pango_scale[5] = PANGO_SCALE_XX_LARGE;
+ pango_scale[6] = 1.2 * PANGO_SCALE_XX_LARGE;
+ break;
+ case NAUTILUS_ZOOM_LEVEL_SMALL:
+ pango_scale[0] = PANGO_SCALE_SMALL;
+ pango_scale[1] = PANGO_SCALE_MEDIUM;
+ pango_scale[2] = PANGO_SCALE_LARGE;
+ pango_scale[3] = PANGO_SCALE_X_LARGE;
+ pango_scale[4] = PANGO_SCALE_XX_LARGE;
+ pango_scale[5] = 1.2 * PANGO_SCALE_XX_LARGE;
+ pango_scale[6] = 1.2 * 1.2 * PANGO_SCALE_XX_LARGE;
+ break;
+ case NAUTILUS_ZOOM_LEVEL_SMALLER:
+ /* From here on down we use PANGO_SCALE_MEDIUM for the
+ * default zoom. Since the icons are now smaller this
+ * looks better at default zoom.
+ */
+ pango_scale[0] = PANGO_SCALE_SMALL;
+ pango_scale[1] = PANGO_SCALE_MEDIUM;
+ pango_scale[2] = PANGO_SCALE_LARGE;
+ pango_scale[3] = PANGO_SCALE_X_LARGE;
+ pango_scale[4] = PANGO_SCALE_XX_LARGE;
+ pango_scale[5] = 1.2 * PANGO_SCALE_XX_LARGE;
+ pango_scale[6] = 1.2 * 1.2 * PANGO_SCALE_XX_LARGE;
+ break;
+ case NAUTILUS_ZOOM_LEVEL_SMALLEST:
+ pango_scale[0] = PANGO_SCALE_MEDIUM;
+ pango_scale[1] = PANGO_SCALE_LARGE;
+ pango_scale[2] = PANGO_SCALE_X_LARGE;
+ pango_scale[3] = PANGO_SCALE_XX_LARGE;
+ pango_scale[4] = 1.2 * PANGO_SCALE_XX_LARGE;
+ pango_scale[5] = 1.2 * 1.2 * PANGO_SCALE_XX_LARGE;
+ pango_scale[6] = 1.2 * 1.2 * 1.2 * PANGO_SCALE_XX_LARGE;
+ break;
+ default:
+ g_warning ("invalid default list-view zoom level");
+ pango_scale[0] = PANGO_SCALE_X_SMALL;
+ pango_scale[1] = PANGO_SCALE_SMALL;
+ pango_scale[2] = PANGO_SCALE_MEDIUM;
+ pango_scale[3] = PANGO_SCALE_LARGE;
+ pango_scale[4] = PANGO_SCALE_X_LARGE;
+ pango_scale[5] = PANGO_SCALE_XX_LARGE;
+ pango_scale[6] = 1.2 * PANGO_SCALE_XX_LARGE;
+ break;
+ }
+ }
+
+ g_object_set (G_OBJECT (view->details->file_name_cell),
+ "scale", pango_scale[new_level],
+ NULL);
+ g_object_set (G_OBJECT (view->details->size_cell),
+ "scale", pango_scale[new_level],
+ NULL);
+ g_object_set (G_OBJECT (view->details->type_cell),
+ "scale", pango_scale[new_level],
+ NULL);
+ g_object_set (G_OBJECT (view->details->date_modified_cell),
+ "scale", pango_scale[new_level],
+ NULL);
+}
+
+static void
fm_list_view_set_zoom_level (FMListView *view,
NautilusZoomLevel new_level,
gboolean always_set_level)
{
- static double pango_scale[7] = { PANGO_SCALE_X_SMALL,
- PANGO_SCALE_SMALL,
- PANGO_SCALE_MEDIUM,
- PANGO_SCALE_LARGE,
- PANGO_SCALE_X_LARGE,
- PANGO_SCALE_XX_LARGE,
- 1.2 * PANGO_SCALE_XX_LARGE };
int icon_size;
int column;
@@ -595,18 +715,7 @@ fm_list_view_set_zoom_level (FMListView
NULL);
/* Scale text. */
- g_object_set (G_OBJECT (view->details->file_name_cell),
- "scale", pango_scale[new_level],
- NULL);
- g_object_set (G_OBJECT (view->details->size_cell),
- "scale", pango_scale[new_level],
- NULL);
- g_object_set (G_OBJECT (view->details->type_cell),
- "scale", pango_scale[new_level],
- NULL);
- g_object_set (G_OBJECT (view->details->date_modified_cell),
- "scale", pango_scale[new_level],
- NULL);
+ fm_list_view_scale_font_size (view, new_level, FALSE);
/* Make all rows the same size. */
icon_size = nautilus_get_icon_size_for_zoom_level (new_level);
@@ -843,6 +952,6 @@ fm_list_view_instance_init (FMListView *
list_view, G_OBJECT (list_view));
click_policy_changed_callback (list_view);
-
+
fm_list_view_sort_directories_first_changed (FM_DIRECTORY_VIEW (list_view));
}
Index: src/file-manager/fm-icon-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-icon-view.c,v
retrieving revision 1.261
diff -u -p -r1.261 fm-icon-view.c
--- src/file-manager/fm-icon-view.c 2002/05/21 18:24:19 1.261
+++ src/file-manager/fm-icon-view.c 2002/06/03 01:41:46
@@ -959,6 +959,95 @@ fm_icon_view_end_loading (FMDirectoryVie
icon_view->details->loading = FALSE;
}
+static void
+fm_icon_view_update_font_size_table (FMIconView *view)
+{
+ NautilusIconContainer *container;
+ int font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST + 1];
+
+ container = get_icon_container (view);
+ g_assert (container != NULL);
+
+ switch (get_default_zoom_level ())
+ {
+ case NAUTILUS_ZOOM_LEVEL_LARGEST:
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLEST] = -5 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLER] = -4 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALL] = -4 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_STANDARD] = -3 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGE] = -3 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGER] = -2 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST] = 0 * PANGO_SCALE;
+ break;
+ case NAUTILUS_ZOOM_LEVEL_LARGER:
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLEST] = -4 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLER] = -4 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALL] = -3 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_STANDARD] = -3 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGE] = -2 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGER] = 0 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST] = 2 * PANGO_SCALE;
+ break;
+ case NAUTILUS_ZOOM_LEVEL_LARGE:
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLEST] = -4 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLER] = -3 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALL] = -3 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_STANDARD] = -2 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGE] = 0 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGER] = 2 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST] = 4 * PANGO_SCALE;
+ break;
+ case NAUTILUS_ZOOM_LEVEL_STANDARD:
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLEST] = -3 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLER] = -3 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALL] = -2 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_STANDARD] = 0 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGE] = 2 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGER] = 4 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST] = 4 * PANGO_SCALE;
+ break;
+ case NAUTILUS_ZOOM_LEVEL_SMALL:
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLEST] = -3 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLER] = -2 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALL] = 0 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_STANDARD] = 2 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGE] = 4 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGER] = 4 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST] = 5 * PANGO_SCALE;
+ break;
+ case NAUTILUS_ZOOM_LEVEL_SMALLER:
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLEST] = -2 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLER] = 0 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALL] = 2 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_STANDARD] = 4 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGE] = 4 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGER] = 5 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST] = 5 * PANGO_SCALE;
+ break;
+ case NAUTILUS_ZOOM_LEVEL_SMALLEST:
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLEST] = 0 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLER] = 2 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALL] = 4 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_STANDARD] = 4 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGE] = 5 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGER] = 5 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST] = 6 * PANGO_SCALE;
+ break;
+ default:
+ g_warning ("invalid default list-view zoom level");
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLEST] = -3 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLER] = -3 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_SMALL] = -2 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_STANDARD] = 0 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGE] = 2 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGER] = 4 * PANGO_SCALE;
+ font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST] = 4 * PANGO_SCALE;
+ break;
+ }
+
+ nautilus_icon_container_set_font_size_table (container, font_size_table);
+}
+
static NautilusZoomLevel
fm_icon_view_get_zoom_level (FMIconView *view)
{
@@ -2012,6 +2101,7 @@ default_zoom_level_changed_callback (gpo
level = nautilus_file_get_integer_metadata (file,
NAUTILUS_METADATA_KEY_ICON_VIEW_ZOOM_LEVEL,
get_default_zoom_level ());
+ fm_icon_view_update_font_size_table (icon_view);
fm_icon_view_set_zoom_level (icon_view, level, TRUE);
}
}
@@ -2130,6 +2220,7 @@ create_icon_container (FMIconView *icon_
GTK_WIDGET (icon_container));
fm_icon_view_update_click_mode (icon_view);
+ fm_icon_view_update_font_size_table (icon_view);
gtk_widget_show (GTK_WIDGET (icon_container));
}
Index: src/nautilus-application.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-application.c,v
retrieving revision 1.187
diff -u -p -r1.187 nautilus-application.c
--- src/nautilus-application.c 2002/05/22 18:37:35 1.187
+++ src/nautilus-application.c 2002/06/03 01:41:46
@@ -631,11 +631,51 @@ nautilus_window_delete_event_callback (G
NautilusWindow *window;
window = NAUTILUS_WINDOW (widget);
+
+ /* save the geometry if the idle function hasn't been called */
+ if (window->save_geometry_idle_id != 0) {
+ g_source_remove (window->save_geometry_idle_id);
+ nautilus_window_save_geometry (window);
+ }
+
nautilus_window_close (window);
return TRUE;
-}
+}
+
+static gboolean
+save_window_geometry_idle (gpointer callback_data)
+{
+ NautilusWindow *window;
+
+ window = NAUTILUS_WINDOW (callback_data);
+
+ nautilus_window_save_geometry (window);
+
+ window->save_geometry_idle_id = 0;
+ return FALSE;
+}
+static gboolean
+nautilus_window_configure_event_callback (GtkWidget *widget,
+ GdkEventConfigure *event,
+ gpointer callback_data)
+{
+ NautilusWindow *window;
+
+ window = NAUTILUS_WINDOW (widget);
+
+ /* Only save the geometry when we are idle,
+ * since we receive configure events all the time.
+ */
+ if (window->save_geometry_idle_id == 0) {
+ window->save_geometry_idle_id =
+ g_idle_add (save_window_geometry_idle, window);
+ }
+
+ return FALSE;
+}
+
NautilusWindow *
nautilus_application_create_window (NautilusApplication *application)
{
@@ -652,6 +692,9 @@ nautilus_application_create_window (Naut
g_signal_connect_object (window, "destroy",
G_CALLBACK (nautilus_application_destroyed_window), application, 0);
+
+ g_signal_connect (window, "configure_event",
+ G_CALLBACK (nautilus_window_configure_event_callback), NULL);
nautilus_application_window_list = g_list_prepend (nautilus_application_window_list, window);
Index: src/nautilus-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window.c,v
retrieving revision 1.388
diff -u -p -r1.388 nautilus-window.c
--- src/nautilus-window.c 2002/05/24 21:54:05 1.388
+++ src/nautilus-window.c 2002/06/03 01:41:47
@@ -864,7 +864,7 @@ nautilus_window_finalize (GObject *objec
G_OBJECT_CLASS (parent_class)->finalize (object);
}
-static void
+void
nautilus_window_save_geometry (NautilusWindow *window)
{
char *geometry_string;
@@ -884,15 +884,7 @@ nautilus_window_save_geometry (NautilusW
void
nautilus_window_close (NautilusWindow *window)
{
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
-
- /* Save the window position in the directory's metadata only if
- * we're in every-location-in-its-own-window mode. Otherwise it
- * would be too apparently random when the stored positions change.
- */
- if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW)) {
- nautilus_window_save_geometry (window);
- }
+ g_return_if_fail (NAUTILUS_IS_WINDOW (window));
gtk_widget_destroy (GTK_WIDGET (window));
}
Index: src/nautilus-window.h
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window.h,v
retrieving revision 1.100
diff -u -p -r1.100 nautilus-window.h
--- src/nautilus-window.h 2002/04/21 21:15:41 1.100
+++ src/nautilus-window.h 2002/06/03 01:41:47
@@ -82,7 +82,8 @@ struct NautilusWindow {
GtkWidget *navigation_bar;
guint status_bar_clear_id;
-
+ guint save_geometry_idle_id;
+
/** CORBA-related elements **/
NautilusApplication *application;
@@ -153,5 +154,6 @@ gboolean nautilus_window_sidebar_showin
void nautilus_window_hide_status_bar (NautilusWindow *window);
void nautilus_window_show_status_bar (NautilusWindow *window);
gboolean nautilus_window_status_bar_showing (NautilusWindow *window);
+void nautilus_window_save_geometry (NautilusWindow *window);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]