[gnome-photos/gnome-3-26] Revert "application, source-manager: Add an option to run without ..."



commit 9a17b5e4966c14562af6270079f403f788a47969
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Dec 8 20:01:15 2017 +0100

    Revert "application, source-manager: Add an option to run without ..."
    
    It broke the string freeze. Since this isn't part of the actual
    bug-fix, it's better to just back it out.
    
    This reverts commit c0b6077a4bfc9a5160fbc51e2609a11371a84c18.

 src/photos-application.c    |   40 ----------------------------------------
 src/photos-application.h    |    2 --
 src/photos-source-manager.c |   22 +++-------------------
 3 files changed, 3 insertions(+), 61 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index 7953296..21b61a8 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -122,7 +122,6 @@ struct _PhotosApplication
   PhotosSelectionController *sel_cntrlr;
   PhotosThumbnailFactory *factory;
   TrackerExtractPriority *extract_priority;
-  gboolean empty_results;
   gboolean main_window_deleted;
   guint create_miners_count;
   guint init_fishes_id;
@@ -155,7 +154,6 @@ enum
 
 static const GOptionEntry COMMAND_LINE_OPTIONS[] =
 {
-  { "empty-results", 0, G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, NULL, N_("Show the empty state"), NULL },
   { "version", 0, G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, NULL, N_("Show the application's version"), NULL},
   { NULL }
 };
@@ -1642,34 +1640,6 @@ photos_application_activate (GApplication *application)
 }
 
 
-static gint
-photos_application_command_line (GApplication *application, GApplicationCommandLine *command_line)
-{
-  PhotosApplication *self = PHOTOS_APPLICATION (application);
-  GVariantDict *options;
-  gint ret_val = -1;
-
-  photos_debug (PHOTOS_DEBUG_APPLICATION, "PhotosApplication::command_line");
-
-  options = g_application_command_line_get_options_dict (command_line);
-  if (g_variant_dict_contains (options, "empty-results"))
-    {
-      if (g_application_command_line_get_is_remote (command_line))
-        {
-          ret_val = EXIT_FAILURE;
-          goto out;
-        }
-
-      self->empty_results = TRUE;
-    }
-
-  g_application_activate (application);
-
- out:
-  return ret_val;
-}
-
-
 static gboolean
 photos_application_dbus_register (GApplication *application,
                                   GDBusConnection *connection,
@@ -2187,7 +2157,6 @@ photos_application_init (PhotosApplication *self)
   self->activation_timestamp = GDK_CURRENT_TIME;
 
   g_application_add_main_option_entries (G_APPLICATION (self), COMMAND_LINE_OPTIONS);
-  g_application_set_flags (G_APPLICATION (self), G_APPLICATION_HANDLES_COMMAND_LINE);
 }
 
 
@@ -2200,7 +2169,6 @@ photos_application_class_init (PhotosApplicationClass *class)
   object_class->dispose = photos_application_dispose;
   object_class->finalize = photos_application_finalize;
   application_class->activate = photos_application_activate;
-  application_class->command_line = photos_application_command_line;
   application_class->dbus_register = photos_application_dbus_register;
   application_class->dbus_unregister = photos_application_dbus_unregister;
   application_class->handle_local_options = photos_application_handle_local_options;
@@ -2236,14 +2204,6 @@ photos_application_new (void)
 }
 
 
-gboolean
-photos_application_get_empty_results (PhotosApplication *self)
-{
-  g_return_val_if_fail (PHOTOS_IS_APPLICATION (self), FALSE);
-  return self->empty_results;
-}
-
-
 GomMiner *
 photos_application_get_miner (PhotosApplication *self, const gchar *provider_type)
 {
diff --git a/src/photos-application.h b/src/photos-application.h
index b14f408..caf3a38 100644
--- a/src/photos-application.h
+++ b/src/photos-application.h
@@ -36,8 +36,6 @@ G_DECLARE_FINAL_TYPE (PhotosApplication, photos_application, PHOTOS, APPLICATION
 
 GApplication          *photos_application_new                    (void);
 
-gboolean               photos_application_get_empty_results      (PhotosApplication *self);
-
 GomMiner              *photos_application_get_miner              (PhotosApplication *self,
                                                                   const gchar *provider_type);
 
diff --git a/src/photos-source-manager.c b/src/photos-source-manager.c
index 3f8b5e3..67b2941 100644
--- a/src/photos-source-manager.c
+++ b/src/photos-source-manager.c
@@ -30,7 +30,6 @@
 #include <glib/gi18n.h>
 #include <goa/goa.h>
 
-#include "photos-application.h"
 #include "photos-filterable.h"
 #include "photos-query.h"
 #include "photos-source.h"
@@ -66,18 +65,10 @@ G_DEFINE_TYPE (PhotosSourceManager, photos_source_manager, PHOTOS_TYPE_BASE_MANA
 static gchar *
 photos_source_manager_get_filter (PhotosBaseManager *mngr, gint flags)
 {
-  GApplication *app;
   GObject *source;
   const gchar *id;
   gchar *filter;
 
-  app = g_application_get_default ();
-  if (photos_application_get_empty_results (PHOTOS_APPLICATION (app)))
-    {
-      filter = g_strdup ("(false)");
-      goto out;
-    }
-
   if (flags & PHOTOS_QUERY_FLAGS_SEARCH)
     source = photos_base_manager_get_active_object (mngr);
   else
@@ -89,7 +80,6 @@ photos_source_manager_get_filter (PhotosBaseManager *mngr, gint flags)
   else
     filter = photos_filterable_get_filter (PHOTOS_FILTERABLE (source));
 
- out:
   return filter;
 }
 
@@ -117,17 +107,12 @@ photos_source_manager_remove_object_by_id (PhotosBaseManager *mngr, const gchar
 static void
 photos_source_manager_refresh_accounts (PhotosSourceManager *self)
 {
-  GApplication *app;
-  GHashTable *new_sources = NULL;
-  GList *accounts = NULL;
+  GHashTable *new_sources;
+  GList *accounts;
   GList *l;
   guint i;
   guint n_items;
 
-  app = g_application_get_default ();
-  if (photos_application_get_empty_results (PHOTOS_APPLICATION (app)))
-    goto out;
-
   accounts = goa_client_get_accounts (self->client);
   new_sources = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
 
@@ -200,8 +185,7 @@ photos_source_manager_refresh_accounts (PhotosSourceManager *self)
       g_clear_object (&source);
     }
 
- out:
-  g_clear_pointer (&new_sources, (GDestroyNotify) g_hash_table_unref);
+  g_hash_table_unref (new_sources);
   g_list_free_full (accounts, g_object_unref);
 }
 


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