Skip to content

Commit e362fef

Browse files
author
raveit65
committed
Revert "Fix indents, update docs to reflect ability to open URIs in tabs"
This reverts commit 424cf44.
1 parent 424cf44 commit e362fef

File tree

3 files changed

+68
-70
lines changed

3 files changed

+68
-70
lines changed

docs/caja.1

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ X display to use.
2626
\fB\-g, \-\-geometry=\fIGEOMETRY\fR
2727
Create the initial window with the given geometry.
2828
.TP
29-
\fB\-t, \-\-tabs\fR
30-
Open URIs in tabs.
31-
.TP
3229
\fB\-n, \-\-no\-default\-window\fR
3330
Only create windows for explicitly specified URIs.
3431
.TP

src/caja-application.c

Lines changed: 67 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,7 @@ caja_empty_callback_to_ensure_read() {
221221

222222
static void
223223
open_window (CajaApplication *application,
224-
GFile *location,
225-
GdkScreen *screen,
226-
const char *geometry,
227-
gboolean browser_window)
224+
GFile *location, GdkScreen *screen, const char *geometry, gboolean browser_window)
228225
{
229226
CajaApplication *self = CAJA_APPLICATION (application);
230227
CajaWindow *window;
@@ -242,7 +239,9 @@ open_window (CajaApplication *application,
242239
if (browser_window ||g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) {
243240
window = caja_application_create_navigation_window (application,
244241
screen);
245-
} else {
242+
}
243+
244+
else {
246245
window = caja_application_get_spatial_window (application,
247246
NULL,
248247
NULL,
@@ -255,7 +254,8 @@ open_window (CajaApplication *application,
255254

256255
if (geometry != NULL && !gtk_widget_get_visible (GTK_WIDGET (window))) {
257256
/* never maximize windows opened from shell if a
258-
* custom geometry has been requested. */
257+
* custom geometry has been requested.
258+
*/
259259
gtk_window_unmaximize (GTK_WINDOW (window));
260260
eel_gtk_window_set_initial_geometry_from_string (GTK_WINDOW (window),
261261
geometry,
@@ -269,86 +269,84 @@ open_window (CajaApplication *application,
269269

270270
static void
271271
open_tabs (CajaApplication *application,
272-
GFile **locations,
273-
guint n_files,
274-
GdkScreen *screen,
275-
const char *geometry,
276-
gboolean browser_window)
272+
GFile **locations, guint n_files, GdkScreen *screen, const char *geometry, gboolean browser_window)
277273
{
278274
CajaApplication *self = CAJA_APPLICATION (application);
279275
CajaWindow *window;
280276
gchar *uri = NULL;
281-
/* monitor the preference to use browser or spatial windows */
282-
/* connect before trying to read or this preference won't be read by root or after change */
283-
g_signal_connect_swapped (caja_preferences,
284-
"changed::"CAJA_PREFERENCES_ALWAYS_USE_BROWSER,
285-
G_CALLBACK (caja_empty_callback_to_ensure_read),
286-
self);
277+
278+
/*monitor the preference to use browser or spatial windows */
279+
/*connect before trying to read or this preference won't be read by root or after change*/
280+
g_signal_connect_swapped(caja_preferences, "changed::"CAJA_PREFERENCES_ALWAYS_USE_BROWSER,
281+
G_CALLBACK (caja_empty_callback_to_ensure_read),
282+
self);
287283

288284
if (browser_window ||g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) {
289-
window = caja_application_create_navigation_window (application, screen);
285+
window = caja_application_create_navigation_window (application,
286+
screen);
290287
} else {
291288
window = caja_application_get_spatial_window (application,
292-
NULL,
293-
NULL,
294-
locations[0],
295-
screen,
296-
NULL);
289+
NULL,
290+
NULL,
291+
locations[0],
292+
screen,
293+
NULL);
297294
}
298295

299296
/* open all locations */
300297
uri = g_file_get_uri (locations[0]);
301-
g_debug ("Opening new tab at uri %s\n", uri);
298+
g_debug("Opening new tab at uri %s\n", uri);
302299
caja_window_go_to (window, locations[0]);
303-
for (int i = 1; i< n_files;i++) {
300+
for (int i = 1; i< n_files;i++){
304301
/* open tabs in reverse order because each
305302
* tab is opened before the previous one */
306303
guint tab = n_files-i;
307304
uri = g_file_get_uri (locations[tab]);
308-
g_debug ("Opening new tab at uri %s\n", uri);
309-
if (i == 0) {
305+
g_debug("Opening new tab at uri %s\n", uri);
306+
if(i==0){
310307
caja_window_go_to (window, locations[tab]);
311-
} else {
308+
}else{
312309
caja_window_go_to_tab (window, locations[tab]);
313310
}
314311
}
315312

316313
if (geometry != NULL && !gtk_widget_get_visible (GTK_WIDGET (window))) {
317314
/* never maximize windows opened from shell if a
318-
* custom geometry has been requested. */
315+
* custom geometry has been requested.
316+
*/
319317
gtk_window_unmaximize (GTK_WINDOW (window));
320318
eel_gtk_window_set_initial_geometry_from_string (GTK_WINDOW (window),
321-
geometry,
322-
APPLICATION_WINDOW_MIN_WIDTH,
323-
APPLICATION_WINDOW_MIN_HEIGHT,
324-
FALSE);
319+
geometry,
320+
APPLICATION_WINDOW_MIN_WIDTH,
321+
APPLICATION_WINDOW_MIN_HEIGHT,
322+
FALSE);
325323
}
326324

327325
g_free (uri);
328326
}
329327

330328
static void
331329
open_windows (CajaApplication *application,
332-
GFile **files,
333-
GdkScreen *screen,
334-
const char *geometry,
335-
guint n_files,
336-
gboolean browser_window,
337-
gboolean open_in_tabs)
330+
GFile **files,
331+
GdkScreen *screen,
332+
const char *geometry,
333+
guint n_files,
334+
gboolean browser_window,
335+
gboolean open_in_tabs)
338336
{
339337
guint i;
340338

341339
if (files == NULL || files[0] == NULL) {
342340
/* Open a window pointing at the default location. */
343341
open_window (application, NULL, screen, geometry, browser_window);
344342
} else {
345-
if (open_in_tabs) {
343+
if(open_in_tabs){
346344
/* Open one window with one tab at each requested location */
347345
open_tabs (application, files, n_files, screen, geometry, browser_window);
348-
} else {
346+
}else{
349347
/* Open windows at each requested location. */
350348
i = 0;
351-
while (i < n_files) {
349+
while (i < n_files ){
352350
open_window (application, files[i], screen, geometry, browser_window);
353351
i++ ;
354352
}
@@ -358,9 +356,9 @@ open_windows (CajaApplication *application,
358356

359357
static void
360358
caja_application_open (GApplication *app,
361-
GFile **files,
362-
gint n_files,
363-
const gchar *options)
359+
GFile **files,
360+
gint n_files,
361+
const gchar *options)
364362
{
365363
CajaApplication *self = CAJA_APPLICATION (app);
366364
gboolean browser_window = FALSE;
@@ -370,27 +368,28 @@ caja_application_open (GApplication *app,
370368

371369
g_debug ("Open called on the GApplication instance; %d files", n_files);
372370

373-
/* Check if local command line passed --browser, --geometry or --tabs */
374-
if (strlen (options) > 0) {
371+
/*Check if local command line passed --browser, --geometry or --tabs*/
372+
if (strlen(options) > 0){
375373
gchar** splitedOptions = g_strsplit (options, &splitter, 3);
376-
sscanf (splitedOptions[0], "%d", &browser_window);
377-
if (strcmp (splitedOptions[1], "NULL") != 0) {
374+
sscanf(splitedOptions[0], "%d", &browser_window);
375+
if(strcmp(splitedOptions[1], "NULL")!=0){
378376
geometry = splitedOptions[1];
379377
}
380-
sscanf (splitedOptions[2], "%d", &open_in_tabs);
378+
sscanf(splitedOptions[2], "%d", &open_in_tabs);
381379

382-
/* Reset this or 3ed and later invocations will use same
383-
* geometry even if the user has resized open window */
380+
/*Reset this or 3ed and later invocations will use same
381+
*geometry even if the user has resized open window
382+
*/
384383
self->priv->geometry = NULL;
385-
g_strfreev (splitedOptions);
384+
g_strfreev(splitedOptions);
386385
}
387386

388-
open_windows (self, files,
389-
gdk_screen_get_default (),
390-
geometry,
391-
n_files,
392-
browser_window,
393-
open_in_tabs);
387+
open_windows (self, files,
388+
gdk_screen_get_default (),
389+
geometry,
390+
n_files,
391+
browser_window,
392+
open_in_tabs);
394393
}
395394

396395
void
@@ -426,7 +425,7 @@ caja_application_quit (CajaApplication *self)
426425

427426
windows = gtk_application_get_windows (GTK_APPLICATION (app));
428427
g_list_foreach (windows, (GFunc) gtk_widget_destroy, NULL);
429-
/* we have been asked to force quit */
428+
/* we have been asked to force quit */
430429
g_application_quit (G_APPLICATION (self));
431430
}
432431

@@ -2092,7 +2091,7 @@ caja_application_local_command_line (GApplication *application,
20922091
{ "force-desktop", '\0', 0, G_OPTION_ARG_NONE, &self->priv->force_desktop,
20932092
N_("Manage the desktop regardless of set preferences or environment (on new startup only)"), NULL },
20942093
{ "tabs", 't', 0, G_OPTION_ARG_NONE, &open_in_tabs,
2095-
N_("Open URIs in tabs."), NULL },
2094+
N_("Open URI in tabs."), NULL },
20962095
{ "browser", '\0', 0, G_OPTION_ARG_NONE, &browser_window,
20972096
N_("Open a browser window."), NULL },
20982097
{ "quit", 'q', 0, G_OPTION_ARG_NONE, &kill_shell,
@@ -2217,14 +2216,15 @@ caja_application_local_command_line (GApplication *application,
22172216
/*Invoke "Open" to create new windows */
22182217
if (len > 0) {
22192218
gchar* concatOptions = g_malloc0(64);
2220-
if (self->priv->geometry == NULL) {
2221-
g_snprintf (concatOptions, 64, "%d=NULL=%d", browser_window, open_in_tabs);
2222-
} else {
2223-
g_snprintf (concatOptions, 64, "%d=%s=%d", browser_window, self->priv->geometry, open_in_tabs);
2219+
if(self->priv->geometry==NULL){
2220+
g_snprintf(concatOptions, 64, "%d=NULL=%d", browser_window, open_in_tabs);
2221+
}else{
2222+
g_snprintf(concatOptions, 64, "%d=%s=%d", browser_window, self->priv->geometry, open_in_tabs);
22242223
}
22252224
g_application_open (application, files, len, concatOptions);
2226-
g_free (concatOptions);
2225+
g_free(concatOptions);
22272226
} else {
2227+
g_print("non\n");
22282228
if (len > 0) {
22292229
g_application_open (application, files, len, "");
22302230
}
@@ -2238,6 +2238,7 @@ caja_application_local_command_line (GApplication *application,
22382238
out:
22392239
g_option_context_free (context);
22402240

2241+
22412242
return TRUE;
22422243
}
22432244

src/caja-window.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void caja_window_disconnect_content_view (CajaWindow *window,
136136

137137
void caja_window_go_to (CajaWindow *window,
138138
GFile *location);
139-
void caja_window_go_to_tab (CajaWindow *window,
139+
void caja_window_go_to_tab (CajaWindow *window,
140140
GFile *location);
141141
void caja_window_go_to_full (CajaWindow *window,
142142
GFile *location,

0 commit comments

Comments
 (0)