[gnome-todo] todo-txt: set default source when todo.txt source is not set



commit 46225b60bc9a5c0fd947e82c7e2eb85aa6af16f5
Author: Rohit Kaushik <kaushikrohit325 gmail com>
Date:   Fri Feb 17 16:25:47 2017 +0530

    todo-txt: set default source when todo.txt source is not set
    
    Earlier default source was set when the self->source was NULL.
    but this aprroach is wrong as self->source is set to
    g_settings_get_string (self->settings, "file") during initialization,
    as g_settings_get_string return a empty string if the source is
    never set.
    
    So now set default source is called when the self->source is empty
    and not NULL. Due to this the source is never set on first start
    and hence the plugin does not loads.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=778583

 plugins/todo-txt/gtd-plugin-todo-txt.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/plugins/todo-txt/gtd-plugin-todo-txt.c b/plugins/todo-txt/gtd-plugin-todo-txt.c
index ddbccf0..aac8446 100644
--- a/plugins/todo-txt/gtd-plugin-todo-txt.c
+++ b/plugins/todo-txt/gtd-plugin-todo-txt.c
@@ -164,7 +164,7 @@ gtd_plugin_todo_txt_activate (GtdActivatable *activatable)
 
   self = GTD_PLUGIN_TODO_TXT (activatable);
 
-  if (!self->source)
+  if (!self->source || self->source[0] == '\0')
     {
       gboolean set;
       set = gtd_plugin_todo_txt_set_default_source (self);
@@ -240,7 +240,7 @@ gtd_plugin_todo_txt_source_changed_finished_cb (GtdPluginTodoTxt *self)
 
   self->source = g_settings_get_string (self->settings, "file");
 
-  if (!self->source)
+  if (!self->source || self->source[0] == '\0')
     {
       gboolean set;
       set = gtd_plugin_todo_txt_set_default_source (self);


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