~mitya57/nautilus/lp1224217

« back to all changes in this revision

Viewing changes to debian/patches/10_location_titlebar.patch

  • Committer: seb128
  • Date: 2009-04-01 10:10:49 UTC
  • Revision ID: seb128@seb128-desktop-20090401101049-x0mfut4l85f65jh3
initial nautilus import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Debian #413018
 
2
GNOME #142087
 
3
Option to show the full location in the title bar
 
4
Index: nautilus-2.20.0/libnautilus-private/apps_nautilus_preferences.schemas.in
 
5
===================================================================
 
6
--- nautilus-2.20.0.orig/libnautilus-private/apps_nautilus_preferences.schemas.in       2007-09-18 08:51:48.000000000 +0200
 
7
+++ nautilus-2.20.0/libnautilus-private/apps_nautilus_preferences.schemas.in    2007-09-24 11:39:14.871645609 +0200
 
8
@@ -720,6 +720,21 @@
 
9
       </locale>
 
10
     </schema>
 
11
          
 
12
+     <schema>
 
13
+      <key>/schemas/apps/nautilus/preferences/location_in_title_bar</key>
 
14
+      <applyto>/apps/nautilus/preferences/location_in_title_bar</applyto>
 
15
+      <owner>nautilus</owner>
 
16
+      <type>bool</type>
 
17
+      <default>false</default>
 
18
+      <locale name="C">
 
19
+         <short>Show current location in title bar</short>
 
20
+         <long>
 
21
+             If set to true, windows will have the full location displayed
 
22
+             in their title bar. Otherwise it will only show the folder name.
 
23
+         </long>
 
24
+      </locale>
 
25
+    </schema>
 
26
+
 
27
     <schema>
 
28
       <key>/schemas/apps/nautilus/preferences/start_with_sidebar</key>
 
29
       <applyto>/apps/nautilus/preferences/start_with_sidebar</applyto>
 
30
Index: nautilus-2.20.0/libnautilus-private/nautilus-global-preferences.c
 
31
===================================================================
 
32
--- nautilus-2.20.0.orig/libnautilus-private/nautilus-global-preferences.c      2007-06-27 09:12:34.000000000 +0200
 
33
+++ nautilus-2.20.0/libnautilus-private/nautilus-global-preferences.c   2007-09-24 11:39:14.875645837 +0200
 
34
@@ -378,6 +378,10 @@
 
35
          PREFERENCE_BOOLEAN,
 
36
          GINT_TO_POINTER (TRUE)
 
37
        },
 
38
+       { NAUTILUS_PREFERENCES_LOCATION_IN_TITLE_BAR,
 
39
+         PREFERENCE_BOOLEAN,
 
40
+         GINT_TO_POINTER (TRUE)
 
41
+       },
 
42
        { NAUTILUS_PREFERENCES_START_WITH_SIDEBAR,
 
43
          PREFERENCE_BOOLEAN,
 
44
          GINT_TO_POINTER (TRUE)
 
45
Index: nautilus-2.20.0/libnautilus-private/nautilus-global-preferences.h
 
46
===================================================================
 
47
--- nautilus-2.20.0.orig/libnautilus-private/nautilus-global-preferences.h      2007-06-27 09:12:34.000000000 +0200
 
48
+++ nautilus-2.20.0/libnautilus-private/nautilus-global-preferences.h   2007-09-24 11:39:14.875645837 +0200
 
49
@@ -84,6 +84,7 @@
 
50
 #define NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR           "preferences/start_with_location_bar"
 
51
 #define NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY         "preferences/always_use_location_entry"
 
52
 #define NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR             "preferences/start_with_status_bar"
 
53
+#define NAUTILUS_PREFERENCES_LOCATION_IN_TITLE_BAR            "preferences/location_in_title_bar"
 
54
 #define NAUTILUS_PREFERENCES_START_WITH_SIDEBAR                        "preferences/start_with_sidebar"
 
55
 #define NAUTILUS_PREFERENCES_START_WITH_TOOLBAR                        "preferences/start_with_toolbar"
 
56
 #define NAUTILUS_PREFERENCES_SIDE_PANE_VIEW                     "preferences/side_pane_view"
 
57
Index: nautilus-2.20.0/src/nautilus-navigation-window.c
 
58
===================================================================
 
59
--- nautilus-2.20.0.orig/src/nautilus-navigation-window.c       2007-09-03 16:49:27.000000000 +0200
 
60
+++ nautilus-2.20.0/src/nautilus-navigation-window.c    2007-09-24 11:39:14.875645837 +0200
 
61
@@ -914,20 +914,25 @@
 
62
 static gboolean
 
63
 real_set_title (NautilusWindow *window, const char *title)
 
64
 {
 
65
-       char *full_title;
 
66
-       char *window_title;
 
67
        gboolean changed;
 
68
 
 
69
        changed = EEL_CALL_PARENT_WITH_RETURN_VALUE
 
70
                (NAUTILUS_WINDOW_CLASS, set_title, (window, title));
 
71
 
 
72
        if (changed) {
 
73
-               full_title = g_strdup_printf (_("%s - File Browser"), title);
 
74
+               char *full_title;
 
75
+               char *window_title;
 
76
+               char *location_titlebar;
 
77
+
 
78
+               location_titlebar = nautilus_window_set_location_in_titlebar (window, title);
 
79
+
 
80
+               full_title = g_strdup_printf (_("%s - File Browser"), location_titlebar);
 
81
 
 
82
                window_title = eel_str_middle_truncate (full_title, MAX_TITLE_LENGTH);
 
83
                gtk_window_set_title (GTK_WINDOW (window), window_title);
 
84
                g_free (window_title);
 
85
                g_free (full_title);
 
86
+               g_free (location_titlebar);
 
87
        }
 
88
 
 
89
        return changed;
 
90
Index: nautilus-2.20.0/src/nautilus-spatial-window.c
 
91
===================================================================
 
92
--- nautilus-2.20.0.orig/src/nautilus-spatial-window.c  2007-09-10 08:56:43.000000000 +0200
 
93
+++ nautilus-2.20.0/src/nautilus-spatial-window.c       2007-09-24 11:39:14.875645837 +0200
 
94
@@ -430,10 +430,14 @@
 
95
                gtk_window_set_title (GTK_WINDOW (window), _("Nautilus"));
 
96
        } else if (changed) {
 
97
                char *window_title;
 
98
+               char *location_titlebar;
 
99
 
 
100
-               window_title = eel_str_middle_truncate (title, MAX_TITLE_LENGTH);
 
101
+               location_titlebar = nautilus_window_set_location_in_titlebar (window, title);
 
102
+
 
103
+               window_title = eel_str_middle_truncate (location_titlebar, MAX_TITLE_LENGTH);
 
104
                gtk_window_set_title (GTK_WINDOW (window), window_title);
 
105
                g_free (window_title);
 
106
+               g_free (location_titlebar);
 
107
        }
 
108
 
 
109
        return changed;
 
110
--- nautilus-2.22.0/src/nautilus-window.c.old   2008-03-17 10:49:47.000000000 +0100
 
111
+++ nautilus-2.22.0/src/nautilus-window.c       2008-03-17 11:11:29.000000000 +0100
 
112
@@ -1709,3 +1709,71 @@
 
113
 {
 
114
        return (nautilus_window_get_window_type (window) != NAUTILUS_WINDOW_DESKTOP);
 
115
 }
 
116
+
 
117
+char *
 
118
+nautilus_window_set_location_in_titlebar (NautilusWindow *window, const char *title)
 
119
+{
 
120
+       char *location_title;
 
121
+       GFile *uri = NULL;
 
122
+       char *location = NULL;
 
123
+       const char *path;
 
124
+       const char *scheme = NULL;
 
125
+       const char *display_location;
 
126
+       const char *tmp_location;
 
127
+       const char *location_prefix;
 
128
+       int tmp_location_len;
 
129
+       int tilde = 0;
 
130
+
 
131
+       location_title = g_strdup (title);
 
132
+
 
133
+       if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_LOCATION_IN_TITLE_BAR) != TRUE
 
134
+           || (uri = nautilus_window_get_location (window)) == NULL
 
135
+           || (location = g_file_get_parse_name (uri)) == NULL
 
136
+           || location[0] == 0
 
137
+           || location[1] == 0)
 
138
+               goto done;
 
139
+
 
140
+       if ((tmp_location = g_get_home_dir()) == NULL) {
 
141
+               display_location = location;
 
142
+               goto construct_title;
 
143
+       }
 
144
+
 
145
+       if (strcmp (location, tmp_location) == 0) {
 
146
+               tilde = 1;
 
147
+               display_location = "";
 
148
+               goto construct_title;
 
149
+       }
 
150
+       
 
151
+       tmp_location_len = strlen (tmp_location);
 
152
+       if (eel_str_has_prefix (location, tmp_location) == FALSE
 
153
+           || location[tmp_location_len] != G_DIR_SEPARATOR) {
 
154
+               display_location = location;
 
155
+               goto construct_title;
 
156
+       }
 
157
+
 
158
+       tilde = 1;
 
159
+       display_location = location + tmp_location_len;
 
160
+
 
161
+       construct_title:
 
162
+
 
163
+               g_free (location_title);
 
164
+
 
165
+               if(scheme != NULL)
 
166
+                       location_prefix = scheme;
 
167
+               else if(tilde == 1)
 
168
+                       location_prefix = "~";
 
169
+               else
 
170
+                       location_prefix = "";
 
171
+
 
172
+               location_title = g_strdup_printf ("%s (%s%s%s)", title, location_prefix, scheme != NULL ? " - " : "", display_location);
 
173
+
 
174
+       done:
 
175
+               if (uri != NULL)
 
176
+                       g_object_unref (uri);
 
177
+
 
178
+               if (location != NULL)
 
179
+                       g_free (location);
 
180
+
 
181
+               return (location_title);
 
182
+}
 
183
+
 
184
--- nautilus-2.22.0/src/nautilus-window.h.old   2008-03-17 10:49:50.000000000 +0100
 
185
+++ nautilus-2.22.0/src/nautilus-window.h       2008-03-17 10:51:45.000000000 +0100
 
186
@@ -152,5 +152,7 @@
 
187
 void             nautilus_window_add_extra_location_widget (NautilusWindow  *window,
 
188
                                                             GtkWidget       *widget);
 
189
 gboolean         nautilus_window_has_menubar_and_statusbar (NautilusWindow *window);
 
190
+char *           nautilus_window_set_location_in_titlebar (NautilusWindow *window,
 
191
+                                                           const char        *title);
 
192
 
 
193
 #endif