[gthumb] removed use of libegg



commit a61599e899697e6bb3b995a632dee99d9a8a54f0
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Jan 19 15:10:26 2014 +0100

    removed use of libegg

 Makefile.am                        |    2 +-
 configure.ac                       |   39 -
 copy-n-paste/Makefile.am           |   25 -
 copy-n-paste/eggdesktopfile.c      | 1528 ------------------------------------
 copy-n-paste/eggdesktopfile.h      |  163 ----
 copy-n-paste/eggsmclient-private.h |   59 --
 copy-n-paste/eggsmclient-xsmp.c    | 1380 --------------------------------
 copy-n-paste/eggsmclient.c         |  604 --------------
 copy-n-paste/eggsmclient.h         |  117 ---
 gthumb/Makefile.am                 |    2 -
 gthumb/main.c                      |  213 +-----
 po/POTFILES.in                     |    6 -
 12 files changed, 34 insertions(+), 4104 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 6fe5d71..7318e68 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = m4 copy-n-paste data po gthumb extensions help
+SUBDIRS = m4 data po gthumb extensions help
 
 ACLOCAL_AMFLAGS = -I m4
 
diff --git a/configure.ac b/configure.ac
index 3cbfded..28dffbc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -583,46 +583,8 @@ fi
 
 dnl ===========================================================================
 
-GDK_TARGET="$($PKG_CONFIG --variable targets gdk-3.0)"
-
-AC_MSG_CHECKING([which smclient backend to use])
-AC_ARG_WITH([smclient],
-  [AS_HELP_STRING([--with-smclient=no|auto|xsmp],
-                 [Setting smclient backend (default:no)])],,
-                 [with_smclient=no])
-
-if test "$with_smclient" == "auto"; then
-  case "$GDK_TARGET" in
-    *x11*) with_smclient=xsmp ;;
-    *) with_smclient=no ;;
-  esac
-fi
-
-AC_MSG_RESULT([$with_smclient])
-
-if test "$with_smclient" != "no"; then
-  AC_DEFINE([WITH_SMCLIENT],[1],[Define if smclient is enabled])
-
-  case "$with_smclient" in
-    xsmp) SMCLIENT_PKGS="sm >= 1.0.0 ice" ;;
-    *) SMCLIENT_PKGS="" ;;
-  esac
-
-  PKG_CHECK_MODULES([SMCLIENT],[$SMCLIENT_PKGS])
-  AC_SUBST([SMCLIENT_CFLAGS])
-  AC_SUBST([SMCLIENT_LIBS])
-  AC_DEFINE(USE_SMCLIENT, 1, [Use a session menager])
-fi
-
-AM_CONDITIONAL([WITH_SMCLIENT],[test "$with_smclient" != "no"])
-AM_CONDITIONAL([WITH_SMCLIENT_XSMP],[test "$with_smclient" = "xsmp"])
-AM_CONDITIONAL([WITH_SMCLIENT_WIN32],[test "$with_smclient" = "win32"])
-
-dnl ===========================================================================
-
 AC_CONFIG_FILES([
 Makefile
-copy-n-paste/Makefile
 data/Makefile
 data/gthumb.desktop.in
 data/gthumb-${GTHUMB_API_VERSION}.pc:data/gthumb.pc.in
@@ -781,7 +743,6 @@ Configuration:
        Use libsecret        : ${enable_libsecret}
        Burn disc support    : ${enable_libbrasero}
        Web albums           : ${enable_web_albums}
-       SM client support    : ${with_smclient}
        Map support          : ${enable_libchamplain}
        SVG support          : ${enable_librsvg}
        WebP support         : ${enable_libwebp}
diff --git a/gthumb/Makefile.am b/gthumb/Makefile.am
index 3665d5b..df0251f 100644
--- a/gthumb/Makefile.am
+++ b/gthumb/Makefile.am
@@ -266,7 +266,6 @@ gthumb_LDFLAGS = -Wl,--export-all-symbols,--out-implib,.libs/libgthumb.a
 endif
 
 gthumb_LDADD =                                         \
-       $(top_builddir)/copy-n-paste/libeggsmclient.la  \
        $(GTHUMB_LIBS)                                  \
        $(M_LIBS)                                       \
        $(EXIV2_LIBS)                                   \
@@ -315,7 +314,6 @@ gthumb_CFLAGS =                                                     \
        $(LIBSOUP_CFLAGS)                                       \
        $(LIBCHAMPLAIN_CFLAGS)                                  \
        $(SMCLIENT_CFLAGS)                                      \
-       -I$(top_srcdir)/copy-n-paste/                           \
        -DGTHUMB_LOCALEDIR=\"$(datadir)/locale\"                \
        -DGTHUMB_PREFIX=\"$(prefix)\"                           \
        -DGTHUMB_SYSCONFDIR=\"$(sysconfdir)\"                   \
diff --git a/gthumb/main.c b/gthumb/main.c
index c695ab4..418d397 100644
--- a/gthumb/main.c
+++ b/gthumb/main.c
@@ -23,6 +23,7 @@
 #include <glib/gi18n.h>
 #include <glib/gprintf.h>
 #include <gtk/gtk.h>
+#include <gio/gdesktopappinfo.h>
 #ifdef HAVE_GSTREAMER
 #  include <gst/gst.h>
 #endif
@@ -30,10 +31,6 @@
 #  include <clutter/clutter.h>
 #  include <clutter-gtk/clutter-gtk.h>
 #endif
-#ifdef USE_SMCLIENT
-#  include "eggsmclient.h"
-#endif
-#include "eggdesktopfile.h"
 #include "glib-utils.h"
 #include "gth-browser.h"
 #include "gth-browser-actions-callbacks.h"
@@ -141,184 +138,69 @@ migrate_data (void)
 }
 
 
-/* -- session management -- */
-
-
-#ifdef USE_SMCLIENT
-
-
-static void
-client_save_state (EggSMClient *client,
-                  GKeyFile    *state,
-                  gpointer     user_data)
-{
-       const char *argv[2] = { NULL };
-       GList      *scan;
-       guint       i;
-
-       argv[0] = program_argv0;
-       argv[1] = NULL;
-       egg_sm_client_set_restart_command (client, 1, argv);
-
-       i = 0;
-       for (scan = gtk_application_get_windows (Main_Application); scan; scan = scan->next) {
-               GtkWidget   *window = scan->data;
-               GFile       *location;
-               char        *key;
-               char        *uri;
-               GthFileData *focused_file = NULL;
-
-               focused_file = gth_browser_get_current_file (GTH_BROWSER (window));
-               if (focused_file == NULL)
-                       location = gth_browser_get_location (GTH_BROWSER (window));
-               else
-                       location = focused_file->file;
-
-               if (location == NULL)
-                       continue;
-
-               key = g_strdup_printf ("location%d", ++i);
-               uri = g_file_get_uri (location);
-               g_key_file_set_string (state, "Session", key, uri);
-
-               g_free (uri);
-               g_free (key);
-               g_object_unref (location);
-       }
-
-       g_key_file_set_integer (state, "Session", "locations", i);
-}
-
-
-/* quit_requested handler for the master client */
-
-
-static GList *client_window = NULL;
-
-
-static void modified_file_saved_cb (GthBrowser  *browser,
-                                   gboolean     cancelled,
-                                   gpointer     user_data);
-
+/* -- main application -- */
 
-static void
-check_whether_to_save (EggSMClient *client)
-{
-       for (/* void */; client_window; client_window = client_window->next) {
-               GtkWidget *window = client_window->data;
-
-               if (gth_browser_get_file_modified (GTH_BROWSER (window))) {
-                       gth_browser_ask_whether_to_save (GTH_BROWSER (window),
-                                                        modified_file_saved_cb,
-                                                        client);
-                       return;
-               }
-       }
 
-       egg_sm_client_will_quit (client, TRUE);
-}
+typedef GtkApplication      GthApplication;
+typedef GtkApplicationClass GthApplicationClass;
 
+static gpointer gth_application_parent_class;
 
-static void
-modified_file_saved_cb (GthBrowser *browser,
-                       gboolean    cancelled,
-                       gpointer    user_data)
-{
-       EggSMClient *client = user_data;
 
-       if (cancelled) {
-               egg_sm_client_will_quit (client, FALSE);
-       }
-       else {
-               client_window = client_window->next;
-               check_whether_to_save (client);
-       }
-}
+GType gth_application_get_type (void);
 
 
-static void
-client_quit_requested_cb (EggSMClient *client,
-                         gpointer     data)
-{
-       client_window = gtk_application_get_windows (Main_Application);
-       check_whether_to_save (client);
-}
+G_DEFINE_TYPE (GthApplication, gth_application, GTK_TYPE_APPLICATION)
 
 
 static void
-client_quit_cb (EggSMClient *client,
-               gpointer     data)
+gth_application_finalize (GObject *object)
 {
-       gtk_main_quit ();
+        G_OBJECT_CLASS (gth_application_parent_class)->finalize (object);
 }
 
 
 static void
-restore_session (EggSMClient *client)
+gth_application_init (GthApplication *app)
 {
-       GKeyFile *state = NULL;
-       guint     i;
-
-       state = egg_sm_client_get_state_file (client);
+#ifdef GDK_WINDOWING_X11
 
-       i = g_key_file_get_integer (state, "Session", "locations", NULL);
-       g_assert (i > 0);
-       for (; i > 0; i--) {
-               GtkWidget *window;
-               char      *key;
-               char      *location;
-               GFile     *file;
+       GDesktopAppInfo *app_info;
 
-               key = g_strdup_printf ("location%d", i);
-               location = g_key_file_get_string (state, "Session", key, NULL);
-               g_free (key);
+       app_info = g_desktop_app_info_new ("gthumb.desktop");
+       if (app_info == NULL)
+               return;
 
-               g_assert (location != NULL);
+       if (g_desktop_app_info_has_key (app_info, "Name")) {
+               char *app_name;
 
-               file = g_file_new_for_uri (location);
-               window = gth_browser_new (file, NULL);
-               gtk_widget_show (window);
+               app_name = g_desktop_app_info_get_string (app_info, "Name");
+               g_set_application_name (app_name);
 
-               g_object_unref (file);
-               g_free (location);
+               g_free (app_name);
        }
-}
-
-
-#endif
-
-
-/* -- main application -- */
-
-
-typedef GtkApplication      GthApplication;
-typedef GtkApplicationClass GthApplicationClass;
-
-static gpointer gth_application_parent_class;
-
-
-GType gth_application_get_type (void);
 
+       if (g_desktop_app_info_has_key (app_info, "Icon")) {
+               char *icon;
 
-G_DEFINE_TYPE (GthApplication, gth_application, GTK_TYPE_APPLICATION)
-
+               icon = g_desktop_app_info_get_string (app_info, "Icon");
+               if (g_path_is_absolute (icon))
+                       gtk_window_set_default_icon_from_file (icon, NULL);
+               else
+                       gtk_window_set_default_icon_name (icon);
 
-static void
-gth_application_finalize (GObject *object)
-{
-        G_OBJECT_CLASS (gth_application_parent_class)->finalize (object);
-}
+               g_free (icon);
+       }
 
+       g_object_unref (app_info);
 
-static void
-gth_application_init (GthApplication *app)
-{
-#ifdef GDK_WINDOWING_X11
-       egg_set_desktop_file (GTHUMB_APPLICATIONS_DIR "/gthumb.desktop");
 #else
+
        /* manually set name and icon */
+
        g_set_application_name (_("gThumb"));
        gtk_window_set_default_icon_name ("gthumb");
+
 #endif
 }
 
@@ -393,9 +275,6 @@ gth_application_create_option_context (void)
 
        if (g_once_init_enter (&initialized)) {
                g_option_context_add_group (context, gtk_get_option_group (TRUE));
-#ifdef USE_SMCLIENT
-               g_option_context_add_group (context, egg_sm_client_get_option_group ());
-#endif
 #ifdef HAVE_CLUTTER
                g_option_context_add_group (context, clutter_get_option_group_without_init ());
                g_option_context_add_group (context, gtk_clutter_get_option_group ());
@@ -439,32 +318,6 @@ gth_application_command_line (GApplication            *application,
        }
        g_option_context_free (context);
 
-       /* restore the session */
-
-#ifdef USE_SMCLIENT
-       {
-               EggSMClient *client;
-
-               client = egg_sm_client_get ();
-               g_signal_connect (client,
-                                 "save_state",
-                                 G_CALLBACK (client_save_state),
-                                 NULL);
-               g_signal_connect (client,
-                                 "quit_requested",
-                                 G_CALLBACK (client_quit_requested_cb),
-                                 NULL);
-               g_signal_connect (client,
-                                 "quit",
-                                 G_CALLBACK (client_quit_cb),
-                                 NULL);
-               if (egg_sm_client_is_resumed (client)) {
-                       restore_session (client);
-                       return 0;
-               }
-       }
-#endif
-
        /* exec the command line */
 
        if (ImportPhotos) {
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 5def632..3cc39d4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -4,12 +4,6 @@
 # update the content run the following command:
 # sh update-potfiles.sh > POTFILES.in
 [encoding: UTF-8]
-copy-n-paste/eggdesktopfile.c
-copy-n-paste/eggdesktopfile.h
-copy-n-paste/eggsmclient.c
-copy-n-paste/eggsmclient.h
-copy-n-paste/eggsmclient-private.h
-copy-n-paste/eggsmclient-xsmp.c
 data/gthumb.desktop.in.in
 data/gthumb-import.desktop.in.in
 data/org.gnome.gthumb.change-date.gschema.xml.in


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]