* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include <csignal>
+#include "main.h"
+
#include <sys/mman.h>
+#include <clocale>
+#include <csignal>
+
+#include <config.h>
+
+#ifdef HAVE_CLUTTER
+#include <clutter-gtk/clutter-gtk.h>
+#endif
+
+#ifdef HAVE_EXECINFO_H
+#include <execinfo.h>
+#endif
+
#ifdef G_OS_UNIX
#include <pwd.h>
#endif
-#include <clocale>
-#include "main.h"
+#ifdef HAVE_DEVELOPER
+#include "backward.h"
+#endif
+#include "cache-maint.h"
#include "cache.h"
-#include "collect.h"
#include "collect-io.h"
+#include "collect.h"
+#include "compat.h"
+#include "debug.h"
+#include "exif.h"
#include "filedata.h"
#include "filefilter.h"
+#include "glua.h"
+#include "histogram.h"
#include "history-list.h"
#include "image.h"
#include "img-view.h"
+#include "intl.h"
#include "layout-image.h"
#include "layout-util.h"
+#include "main-defines.h"
+#include "metadata.h"
#include "misc.h"
+#include "pixbuf-util.h"
#include "rcfile.h"
#include "remote.h"
#include "secure-save.h"
+#include "thumb.h"
#include "ui-fileops.h"
#include "ui-utildlg.h"
-#include "cache-maint.h"
-#include "thumb.h"
-#include "metadata.h"
-#include "exif.h"
-#include "histogram.h"
-#include "pixbuf-util.h"
-#include "glua.h"
#include "whereami.h"
-#ifdef HAVE_CLUTTER
-#include <clutter-gtk/clutter-gtk.h>
-#endif
-
-#ifdef HAVE_EXECINFO_H
-#include <execinfo.h>
-#endif
-
gboolean thumb_format_changed = FALSE;
static RemoteConnection *remote_connection = nullptr;
printf_term(FALSE, "%s %s GTK%d\n", GQ_APPNAME, VERSION, gtk_major_version);
exit(0);
}
- else if (strcmp(cmd_line, "--alternate") == 0)
- {
- /* enable faster experimental algorithm */
- log_printf("Alternate similarity algorithm enabled\n");
- image_sim_alternate_set(TRUE);
- }
else if (strcmp(cmd_line, "-h") == 0 ||
strcmp(cmd_line, "--help") == 0)
{
print_term(FALSE, _(" --geometry=WxH+XOFF+YOFF set main window location\n"));
print_term(FALSE, _(" -h, --help show this message\n"));
print_term(FALSE, _(" -l, --list [files] [collections] open collection window for command line\n"));
- print_term(FALSE, _(" -n, --new-instance open a new instance of Geeqie\n"));
- print_term(FALSE, _(" -o:, --log-file:<file> save log data to file\n"));
+ print_term(FALSE, _(" -n, --new-instance open a new instance of Geeqie *\n"));
+ print_term(FALSE, _(" -o:, --log-file:<file> save log data to file\n"));
print_term(FALSE, _(" -r, --remote send following commands to open window\n"));
print_term(FALSE, _(" -rh, --remote-help print remote command list\n"));
print_term(FALSE, _(" -s, --slideshow start in slideshow mode\n"));
print_term(FALSE, _(" +w, --show-log-window show log window\n"));
#ifdef DEBUG
print_term(FALSE, _(" --debug[=level] turn on debug output\n"));
- print_term(FALSE, _(" -g:, --grep:<regexp> filter debug output\n"));
+ print_term(FALSE, _(" -g:, --grep:<regexp> filter debug output\n"));
#endif
-#if 0
- /* these options are not officially supported!
- * only for testing new features, no need to translate them */
- print_term(FALSE, " --alternate use alternate similarity algorithm\n");
-#endif
print_term(FALSE, "\n");
+ print_term(FALSE, "* Normally a single set of configuration files is used for all instances.\nHowever, the environment variables XDG_CONFIG_HOME, XDG_CACHE_HOME, XDG_DATA_HOME\ncan be used to modify this behavior on an individual basis e.g.\n\nXDG_CONFIG_HOME=/tmp/a XDG_CACHE_HOME=/tmp/b geeqie\n\n");
remote_help();
dialog_warning = gtk_message_dialog_new(nullptr, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", "Invalid parameter(s):");
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog_warning), "%s", command_line_errors->str);
gtk_window_set_title(GTK_WINDOW(dialog_warning), GQ_APPNAME);
- gtk_window_set_keep_above(GTK_WINDOW(dialog_warning), TRUE);
+ gq_gtk_window_set_keep_above(GTK_WINDOW(dialog_warning), TRUE);
gtk_dialog_run(GTK_DIALOG(dialog_warning));
- gtk_widget_destroy(dialog_warning);
+ g_object_unref(dialog_warning);
g_string_free(command_line_errors, TRUE);
exit(EXIT_FAILURE);
dialog_warning = gtk_message_dialog_new(nullptr, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", "Invalid parameter(s):");
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog_warning), "%s", command_line_errors->str);
gtk_window_set_title(GTK_WINDOW(dialog_warning), GQ_APPNAME);
- gtk_window_set_keep_above(GTK_WINDOW(dialog_warning), TRUE);
+ gq_gtk_window_set_keep_above(GTK_WINDOW(dialog_warning), TRUE);
gtk_dialog_run(GTK_DIALOG(dialog_warning));
- gtk_widget_destroy(dialog_warning);
+ g_object_unref(dialog_warning);
g_string_free(command_line_errors, TRUE);
exit(EXIT_FAILURE);
{
GString *gstring = g_string_new(changed ? nullptr : "; ");
auto ssi = static_cast<SecureSaveInfo *>(data);
- gchar *tmp, *name;
+ gchar *tmp;
+ gchar *name;
g_string_append(gstring, "(gtk_accel_path \"");
GtkWidget *parent;
LayoutWindow *lw;
gchar *msg;
+ GString *message;
if (exit_dialog)
{
return TRUE;
}
- if (!collection_window_modified_exists()) return FALSE;
+ if (!collection_window_modified_exists() && (layout_window_count() == 1)) return FALSE;
parent = nullptr;
lw = nullptr;
exit_confirm_cancel_cb, nullptr);
g_free(msg);
msg = g_strdup_printf(_("Quit %s"), GQ_APPNAME);
- generic_dialog_add_message(exit_dialog, GQ_ICON_DIALOG_QUESTION,
- msg, _("Collections have been modified. Quit anyway?"), TRUE);
+
+ message = g_string_new(nullptr);
+
+ if (collection_window_modified_exists())
+ {
+ message = g_string_append(message, _("Collections have been modified.\n"));
+ }
+
+ if (layout_window_count() > 1)
+ {
+ g_string_append_printf(message, _("%d windows are open.\n\n"), layout_window_count());
+ }
+
+ message = g_string_append(message, _("Quit anyway?"));
+
+ generic_dialog_add_message(exit_dialog, GQ_ICON_DIALOG_QUESTION, msg, message->str, TRUE);
g_free(msg);
generic_dialog_add_button(exit_dialog, GQ_ICON_QUIT, _("Quit"), exit_confirm_exit_cb, TRUE);
gtk_widget_show(exit_dialog->dialog);
+ g_string_free(message, TRUE);
+
return TRUE;
}
}
#endif
-static void setup_sigbus_handler_unused(void)
+static void setup_sigbus_handler_unused()
{
#if defined(SIGBUS) && defined(SA_SIGINFO)
struct sigaction sigbus_action;
sigbus_action.sa_sigaction = sigbus_handler_cb_unused;
sigbus_action.sa_flags = SA_SIGINFO;
- sigaction(SIGBUS, &sigbus_action, NULL);
+ sigaction(SIGBUS, &sigbus_action, nullptr);
#endif
}
#pragma GCC diagnostic pop
static void set_theme_bg_color()
{
GdkRGBA bg_color;
- GdkColor theme_color;
+ GdkRGBA theme_color;
GtkStyleContext *style_context;
GList *work;
LayoutWindow *lw;
style_context = gtk_widget_get_style_context(lw->window);
gtk_style_context_get_background_color(style_context, GTK_STATE_FLAG_NORMAL, &bg_color);
- theme_color.red = bg_color.red * 65535;
- theme_color.green = bg_color.green * 65535;
- theme_color.blue = bg_color.blue * 65535;
+ theme_color.red = bg_color.red ;
+ theme_color.green = bg_color.green ;
+ theme_color.blue = bg_color.blue ;
while (work)
{
gq_htmldir = g_build_filename(gq_prefix, GQ_HTMLDIR, NULL);
gq_appdir = g_build_filename(gq_prefix, GQ_APPDIR, NULL);
gq_bindir = g_build_filename(gq_prefix, GQ_BINDIR, NULL);
- desktop_file_template = g_build_filename(gq_appdir, "template.desktop", NULL);
+ desktop_file_template = g_build_filename(gq_appdir, "org.geeqie.template.desktop", NULL);
g_free(dirname);
g_free(path);
gint main(gint argc, gchar *argv[])
{
- CollectionData *first_collection = nullptr;
- gchar *buf;
CollectionData *cd = nullptr;
+ CollectionData *first_collection = nullptr;
gboolean disable_clutter = FALSE;
gboolean single_dir = TRUE;
- LayoutWindow *lw;
+ gchar *buf;
+ GdkScreen *screen;
+ GtkCssProvider *provider;
GtkSettings *default_settings;
+ LayoutWindow *lw;
gdk_set_allowed_backends("x11,*");
setup_env_path();
+ screen = gdk_screen_get_default();
+ provider = gtk_css_provider_new();
+ gtk_css_provider_load_from_resource(provider, GQ_RESOURCE_PATH_UI "/custom.css");
+ gtk_style_context_add_provider_for_screen(screen, GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+
if (parse_command_line_for_cache_maintenance_option(argc, argv))
{
process_command_line_for_cache_maintenance_option(argc, argv);
}
/* Show a fade-out notification window if the server has a newer AppImage version */
- if (options->appimage_notifications && g_getenv("APPDIR") && strstr(g_getenv("APPDIR"), "/tmp/.mount_Geeqie"))
+ if (options->appimage_notifications)
{
- appimage_notification();
+ if (g_getenv("APPDIR") && strstr(g_getenv("APPDIR"), "/tmp/.mount_Geeqie"))
+ {
+ appimage_notification();
+ }
+ else if (g_strstr_len(gq_executable_path, -1, "AppRun"))
+ {
+ /* Probably running an extracted AppImage */
+ appimage_notification();
+ }
}
DEBUG_1("%s main: gtk_main", get_exec_time());