summaryrefslogtreecommitdiff
path: root/src/caja-application.c
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2016-10-14 19:08:08 -0400
committerGitHub <[email protected]>2016-10-14 19:08:08 -0400
commit682877311e273282314ce40fc925209cd719a5af (patch)
tree1e23e11ab8451341a381c76f9c853b7742d46741 /src/caja-application.c
parentc27cc572f8f33bdfbbc3dfea8786d05a1818b910 (diff)
parenta4822f6221c000f4db2a38a8b63e22ff64f6ee7e (diff)
downloadcaja-682877311e273282314ce40fc925209cd719a5af.tar.bz2
caja-682877311e273282314ce40fc925209cd719a5af.tar.xz
Merge pull request #661 from lukefromdc/dev-gtk2fix-maybe
Fix GTK2 builds
Diffstat (limited to 'src/caja-application.c')
-rw-r--r--src/caja-application.c82
1 files changed, 42 insertions, 40 deletions
diff --git a/src/caja-application.c b/src/caja-application.c
index f469eccf..ab38e593 100644
--- a/src/caja-application.c
+++ b/src/caja-application.c
@@ -39,7 +39,7 @@
#include "caja-information-panel.h"
#include "caja-history-sidebar.h"
#include "caja-places-sidebar.h"
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
#include "caja-self-check-functions.h"
#endif
#include "caja-notes-viewer.h"
@@ -49,7 +49,7 @@
#include <string.h>
#include <unistd.h>
#include "caja-desktop-window.h"
-#if ENABLE_LIBUNIQUE == (1)
+#if ENABLE_LIBUNIQUE == (TRUE)
#include "caja-main.h"
#endif
#include "caja-spatial-window.h"
@@ -73,7 +73,7 @@
#include <libcaja-private/caja-debug-log.h>
#include <libcaja-private/caja-file-utilities.h>
#include <libcaja-private/caja-global-preferences.h>
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
#include <libcaja-private/caja-lib-self-check-functions.h>
#endif
#include <libcaja-private/caja-extensions.h>
@@ -86,7 +86,7 @@
#define MATE_DESKTOP_USE_UNSTABLE_API
#include <libmate-desktop/mate-bg.h>
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -108,7 +108,7 @@ enum {
/* Keeps track of all the desktop windows. */
static GList *caja_application_desktop_windows;
-#if ENABLE_LIBUNIQUE == (1)
+#if ENABLE_LIBUNIQUE == (TRUE)
/* Keeps track of all the caja windows. */
static GList *caja_application_window_list;
#endif
@@ -122,7 +122,7 @@ static gboolean save_of_accel_map_requested = FALSE;
static CajaFreedesktopDBus *fdb_manager = NULL;
static void desktop_changed_callback (gpointer user_data);
-#if ENABLE_LIBUNIQUE == (1)
+#if ENABLE_LIBUNIQUE == (TRUE)
static void desktop_location_changed_callback (gpointer user_data);
#endif
static void mount_removed_callback (GVolumeMonitor *monitor,
@@ -142,7 +142,7 @@ static void volume_removed_callback (GVolumeMonitor *mo
CajaApplication *application);
static void drive_listen_for_eject_button (GDrive *drive,
CajaApplication *application);
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
static void caja_application_load_session (CajaApplication *application);
static char * caja_application_get_session_data (CajaApplication *self);
void caja_application_quit (CajaApplication *self);
@@ -150,7 +150,7 @@ void caja_application_quit (CajaApplication *self);
static void caja_application_load_session (CajaApplication *application);
static char * caja_application_get_session_data (void);
#endif
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
G_DEFINE_TYPE (CajaApplication, caja_application, GTK_TYPE_APPLICATION);
struct _CajaApplicationPriv {
GVolumeMonitor *volume_monitor;
@@ -252,7 +252,7 @@ caja_application_get_spatial_window_list (void)
return caja_application_spatial_window_list;
}
-#if ENABLE_LIBUNIQUE == (1)
+#if ENABLE_LIBUNIQUE == (TRUE)
unsigned int
caja_application_get_n_windows (void)
{
@@ -278,7 +278,7 @@ automount_all_volumes (CajaApplication *application)
if (g_settings_get_boolean (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTOMOUNT))
{
/* automount all mountable volumes at start-up */
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
volumes = g_volume_monitor_get_volumes (application->priv->volume_monitor);
#else
volumes = g_volume_monitor_get_volumes (application->volume_monitor);
@@ -314,7 +314,7 @@ smclient_save_state_cb (EggSMClient *client,
CajaApplication *application)
{
char *data;
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
data = caja_application_get_session_data (application);
if (data != NULL)
@@ -336,14 +336,14 @@ static void
smclient_quit_cb (EggSMClient *client,
CajaApplication *application)
{
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
caja_application_quit (application);
#else
caja_main_event_loop_quit (TRUE);
#endif
}
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
static void
caja_application_smclient_initialize (CajaApplication *self)
@@ -589,7 +589,7 @@ caja_application_finalize (GObject *object)
application = CAJA_APPLICATION (object);
caja_bookmarks_exiting ();
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
if (application->volume_monitor)
{
g_object_unref (application->priv->volume_monitor);
@@ -701,9 +701,11 @@ check_required_directories (CajaApplication *application)
dialog = eel_show_error_dialog (error_string, detail_string, NULL);
/* We need the main event loop so the user has a chance to see the dialog. */
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
gtk_application_add_window (GTK_APPLICATION (application),
GTK_WINDOW (dialog));
+#elif GTK_CHECK_VERSION (3, 0, 0)
+ caja_main_event_loop_register (GTK_WIDGET (dialog));
#else
caja_main_event_loop_register (GTK_OBJECT (dialog));
#endif
@@ -992,7 +994,7 @@ do_initialize_screensaver (CajaApplication *application)
NULL);
}
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
static void
do_upgrades_once (CajaApplication *self)
@@ -1536,7 +1538,7 @@ selection_clear_event_cb (GtkWidget *widget,
static void
caja_application_create_desktop_windows (CajaApplication *application)
{
-#if ENABLE_LIBUNIQUE == (1)
+#if ENABLE_LIBUNIQUE == (TRUE)
static gboolean create_in_progress = FALSE;
#endif
GdkDisplay *display;
@@ -1545,7 +1547,7 @@ caja_application_create_desktop_windows (CajaApplication *application)
g_return_if_fail (caja_application_desktop_windows == NULL);
g_return_if_fail (CAJA_IS_APPLICATION (application));
-#if ENABLE_LIBUNIQUE == (1)
+#if ENABLE_LIBUNIQUE == (TRUE)
if (create_in_progress)
{
return;
@@ -1573,7 +1575,7 @@ caja_application_create_desktop_windows (CajaApplication *application)
caja_application_desktop_windows =
g_list_prepend (caja_application_desktop_windows, window);
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
gtk_application_add_window (GTK_APPLICATION (application),
GTK_WINDOW (window));
}
@@ -1591,7 +1593,7 @@ caja_application_open_desktop (CajaApplication *application)
caja_application_create_desktop_windows (application);
}
}
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
static void
#else
void
@@ -1606,7 +1608,7 @@ caja_application_close_desktop (void)
}
void
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
caja_application_close_all_navigation_windows (CajaApplication *self)
{
GList *list_copy;
@@ -1780,7 +1782,7 @@ caja_application_close_all_spatial_windows (void)
g_list_free (list_copy);
}
-#if ENABLE_LIBUNIQUE == (1)
+#if ENABLE_LIBUNIQUE == (TRUE)
static void
#if GTK_CHECK_VERSION (3, 0, 0)
caja_application_destroyed_window (GtkWidget *object, CajaApplication *application)
@@ -1808,7 +1810,7 @@ caja_window_delete_event_callback (GtkWidget *widget,
static CajaWindow *
create_window (CajaApplication *application,
GType window_type,
-#if ENABLE_LIBUNIQUE == (1)
+#if ENABLE_LIBUNIQUE == (TRUE)
const char *startup_id,
#endif
GdkScreen *screen)
@@ -1821,7 +1823,7 @@ create_window (CajaApplication *application,
"app", application,
"screen", screen,
NULL));
-#if ENABLE_LIBUNIQUE == (1)
+#if ENABLE_LIBUNIQUE == (TRUE)
if (startup_id)
{
gtk_window_set_startup_id (GTK_WINDOW (window), startup_id);
@@ -1830,7 +1832,7 @@ create_window (CajaApplication *application,
g_signal_connect_data (window, "delete_event",
G_CALLBACK (caja_window_delete_event_callback), NULL, NULL,
G_CONNECT_AFTER);
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
gtk_application_add_window (GTK_APPLICATION (application),
GTK_WINDOW (window));
#else
@@ -1879,7 +1881,7 @@ caja_application_get_spatial_window (CajaApplication *application,
if (existing != NULL) {
*existing = FALSE;
}
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
window = create_window (application, CAJA_TYPE_SPATIAL_WINDOW, screen);
#else
window = create_window (application, CAJA_TYPE_SPATIAL_WINDOW, startup_id, screen);
@@ -1924,7 +1926,7 @@ caja_application_get_spatial_window (CajaApplication *application,
CajaWindow *
caja_application_create_navigation_window (CajaApplication *application,
-#if ENABLE_LIBUNIQUE == (1)
+#if ENABLE_LIBUNIQUE == (TRUE)
const char *startup_id,
#endif
GdkScreen *screen)
@@ -1934,7 +1936,7 @@ caja_application_create_navigation_window (CajaApplication *application,
gboolean maximized;
g_return_val_if_fail (CAJA_IS_APPLICATION (application), NULL);
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
window = create_window (application, CAJA_TYPE_NAVIGATION_WINDOW, screen);
#else
window = create_window (application, CAJA_TYPE_NAVIGATION_WINDOW, startup_id, screen);
@@ -1970,7 +1972,7 @@ caja_application_create_navigation_window (CajaApplication *application,
return window;
}
-#if ENABLE_LIBUNIQUE == (1)
+#if ENABLE_LIBUNIQUE == (TRUE)
/* callback for changing the directory the desktop points to */
static void
desktop_location_changed_callback (gpointer user_data)
@@ -2126,7 +2128,7 @@ autorun_show_window (GMount *mount, gpointer user_data)
/* There should probably be an easier way to do this */
if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) {
window = caja_application_create_navigation_window (application,
-#if ENABLE_LIBUNIQUE == (1)
+#if ENABLE_LIBUNIQUE == (TRUE)
NULL,
#endif
gdk_screen_get_default ());
@@ -2145,7 +2147,7 @@ autorun_show_window (GMount *mount, gpointer user_data)
g_object_unref (location);
}
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
static void
mount_added_callback (GVolumeMonitor *monitor,
GMount *mount,
@@ -2243,7 +2245,7 @@ mount_removed_callback (GVolumeMonitor *monitor,
unclosed_slot = FALSE;
/* Check and see if any of the open windows are displaying contents from the unmounted mount */
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
window_list = gtk_application_get_windows (GTK_APPLICATION (application));
#else
window_list = caja_application_get_window_list ();
@@ -2362,7 +2364,7 @@ icon_from_string (const char *string)
}
return NULL;
}
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
static char *
caja_application_get_session_data (CajaApplication *self)
#else
@@ -2372,7 +2374,7 @@ caja_application_get_session_data (void)
{
xmlDocPtr doc;
xmlNodePtr root_node, history_node;
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
GList *l, *window_list;
#else
GList *l;
@@ -2405,7 +2407,7 @@ caja_application_get_session_data (void)
g_free (tmp);
icon = caja_bookmark_get_icon (bookmark);
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
tmp = g_icon_to_string (icon);
#else
tmp = icon_to_string (icon);
@@ -2428,7 +2430,7 @@ caja_application_get_session_data (void)
break;
}
}
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
window_list = gtk_application_get_windows (GTK_APPLICATION (self));
for (l = window_list; l != NULL; l = l->next) {
#else
@@ -2529,7 +2531,7 @@ caja_application_load_session (CajaApplication *application)
xmlNodePtr root_node;
GKeyFile *state_file;
char *data;
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
caja_application_smclient_initialize (application);
#endif
if (!egg_sm_client_is_resumed (application->smclient))
@@ -2595,7 +2597,7 @@ caja_application_load_session (CajaApplication *application)
icon = NULL;
if (icon_str)
{
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
icon = g_icon_new_for_string (icon_str, NULL);
#else
icon = icon_from_string (icon_str);
@@ -2658,7 +2660,7 @@ caja_application_load_session (CajaApplication *application)
if (g_strcmp0 (type, "navigation") == 0)
{
xmlChar *geometry;
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
window = caja_application_create_navigation_window (application, gdk_screen_get_default ());
#else
window = caja_application_create_navigation_window (application, NULL, gdk_screen_get_default ());
@@ -2784,7 +2786,7 @@ caja_application_load_session (CajaApplication *application)
}
}
-#if ENABLE_LIBUNIQUE == (0)
+#if ENABLE_LIBUNIQUE == (FALSE)
static gboolean
do_cmdline_sanity_checks (CajaApplication *self,
gboolean perform_self_check,