summaryrefslogtreecommitdiff
path: root/src/caja-main.c
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2016-10-08 15:01:44 -0400
committerlukefromdc <[email protected]>2016-10-08 15:01:44 -0400
commit9e5ea15d104720cfee752c193b77f8b03558c6b9 (patch)
treec20e965e974ccdecfe95f576681144442cc6225e /src/caja-main.c
parent24bb72b321c044479728fd1d43c941afc0309f18 (diff)
downloadcaja-9e5ea15d104720cfee752c193b77f8b03558c6b9.tar.bz2
caja-9e5ea15d104720cfee752c193b77f8b03558c6b9.tar.xz
GTK3: port libunique ->GtkApplication as build time option
Add --disable-libunique configuration option for GTK3 builds. This builds a port from libunique to GtkApplication. keep GTK2 builds unchanged Caja can now be build with GTK2 and libunique, GTK3 and libunique, or GTK3 without libunique using GtkApplication instead GtkApplication port Based on cherrypicked nautilus commits from https://github.com/GNOME/nautilus/commit/a8481ee4bd8d34e792d63598fa5efb47736f9de4 main: adapt to GtkApplication changes through https://github.com/GNOME/nautilus/commit/c3382e0415d51082545f277c380d37be160e8d2d application: move nautilus_application_new() to its own function GTK3/GtkApplication builds: add --force-desktop option This is useful for other DE's All: StartupNotify=false in .desktop files, as caja never connects to notification daemons and in GtkApplication builds this causes busy spinning curors
Diffstat (limited to 'src/caja-main.c')
-rw-r--r--src/caja-main.c77
1 files changed, 74 insertions, 3 deletions
diff --git a/src/caja-main.c b/src/caja-main.c
index 95477789..6b411887 100644
--- a/src/caja-main.c
+++ b/src/caja-main.c
@@ -20,7 +20,8 @@
*
* Authors: Elliot Lee <[email protected]>,
* Darin Adler <[email protected]>,
- * John Sullivan <[email protected]>
+ * John Sullivan <[email protected]>,
+ * Cosimo Cecchi <[email protected]>
*
*/
@@ -28,16 +29,19 @@
#include <config.h>
#include "caja-main.h"
-
+#if ENABLE_LIBUNIQUE == (1)
#include "caja-application.h"
#include "caja-self-check-functions.h"
+#endif
#include "caja-window.h"
#include <dlfcn.h>
#include <signal.h>
#include <eel/eel-debug.h>
#include <eel/eel-glib-extensions.h>
#include <eel/eel-self-checks.h>
+#if ENABLE_LIBUNIQUE == (1)
#include <libegg/eggsmclient.h>
+#endif
#include <libegg/eggdesktopfile.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
@@ -45,7 +49,9 @@
#include <gio/gdesktopappinfo.h>
#include <libcaja-private/caja-debug-log.h>
#include <libcaja-private/caja-global-preferences.h>
+#if ENABLE_LIBUNIQUE == (1)
#include <libcaja-private/caja-lib-self-check-functions.h>
+#endif
#include <libcaja-private/caja-icon-names.h>
#include <libxml/parser.h>
#ifdef HAVE_LOCALE_H
@@ -62,6 +68,7 @@
#include <exempi/xmp.h>
#endif
+#if ENABLE_LIBUNIQUE == (1)
/* Keeps track of everyone who wants the main event loop kept active */
static GSList* event_loop_registrants;
@@ -155,7 +162,7 @@ void caja_main_event_loop_quit (gboolean explicit)
gtk_widget_destroy (event_loop_registrants->data);
}
}
-
+#endif
static void dump_debug_log (void)
{
char *filename;
@@ -327,7 +334,70 @@ running_as_root (void)
{
return geteuid () == 0;
}
+#if ENABLE_LIBUNIQUE == (0)
+int
+main (int argc, char *argv[])
+{
+ gint retval;
+ CajaApplication *application;
+
+#if defined (HAVE_MALLOPT) && defined(M_MMAP_THRESHOLD)
+ /* Caja uses lots and lots of small and medium size allocations,
+ * and then a few large ones for the desktop background. By default
+ * glibc uses a dynamic treshold for how large allocations should
+ * be mmaped. Unfortunately this triggers quickly for caja when
+ * it does the desktop background allocations, raising the limit
+ * such that a lot of temporary large allocations end up on the
+ * heap and are thus not returned to the OS. To fix this we set
+ * a hardcoded limit. I don't know what a good value is, but 128K
+ * was the old glibc static limit, lets use that.
+ */
+ mallopt (M_MMAP_THRESHOLD, 128 *1024);
+#endif
+#if !GLIB_CHECK_VERSION (2, 42, 0)
+ /* This will be done by gtk+ later, but for now, force it to MATE */
+ g_desktop_app_info_set_desktop_env ("MATE");
+#endif
+
+ if (g_getenv ("CAJA_DEBUG") != NULL) {
+ eel_make_warnings_and_criticals_stop_in_debugger ();
+ }
+
+ /* Initialize gettext support */
+ bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+
+ g_set_prgname ("caja");
+
+ if (g_file_test (DATADIR "/applications/caja.desktop", G_FILE_TEST_EXISTS)) {
+ egg_set_desktop_file (DATADIR "/applications/caja.desktop");
+ }
+
+#ifdef HAVE_EXEMPI
+ xmp_init();
+#endif
+
+ setup_debug_log ();
+
+ /* Initialize the services that we use. */
+ LIBXML_TEST_VERSION
+
+ /* Run the caja application. */
+ application = caja_application_new();
+
+ retval = g_application_run (G_APPLICATION (application),
+ argc, argv);
+
+ g_object_unref (application);
+
+ eel_debug_shut_down ();
+
+ return retval;
+}
+
+#else
int
main (int argc, char *argv[])
{
@@ -654,3 +724,4 @@ main (int argc, char *argv[])
return EXIT_SUCCESS;
}
+#endif