summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dransfeld <sebastian.dransfeld@sintef.no>2013-06-25 04:32:26 +0200
committerSebastian Dransfeld <sebastian.dransfeld@sintef.no>2013-06-25 04:32:26 +0200
commit71122d59209135df81b2d07b7620557c1fbce031 (patch)
tree341b3642eb7fcfda09b8e2e361ffc2531d683d08
parentf656aa397f02d70dd51a4e450a021fb582b53732 (diff)
efreet: Init no longer fails without dbus session
Allow programs to use efreet without requiering a dbus session. This gives limited functionality, as efreet_icon wont work without a cache. efreet_desktop will partially work, as it reads info from files directly if cache is missing.
-rw-r--r--src/lib/efreet/efreet_cache.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/src/lib/efreet/efreet_cache.c b/src/lib/efreet/efreet_cache.c
index 9c2eaf6654..1ee9d6dd0f 100644
--- a/src/lib/efreet/efreet_cache.c
+++ b/src/lib/efreet/efreet_cache.c
@@ -142,23 +142,24 @@ efreet_cache_init(void)
142 eldbus_init(); 142 eldbus_init();
143 if (efreet_cache_update) 143 if (efreet_cache_update)
144 { 144 {
145 Eldbus_Object *obj;
146
147 conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION); 145 conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION);
148 if (!conn) goto error; 146 if (conn)
147 {
148 Eldbus_Object *obj;
149 149
150 obj = eldbus_object_get(conn, BUS, PATH); 150 obj = eldbus_object_get(conn, BUS, PATH);
151 proxy = eldbus_proxy_get(obj, INTERFACE); 151 proxy = eldbus_proxy_get(obj, INTERFACE);
152 eldbus_proxy_signal_handler_add(proxy, "IconCacheUpdate", icon_cache_update, NULL); 152 eldbus_proxy_signal_handler_add(proxy, "IconCacheUpdate", icon_cache_update, NULL);
153 eldbus_proxy_signal_handler_add(proxy, "DesktopCacheUpdate", desktop_cache_update, NULL); 153 eldbus_proxy_signal_handler_add(proxy, "DesktopCacheUpdate", desktop_cache_update, NULL);
154 154
155 eldbus_proxy_call(proxy, "Register", on_send_register, NULL, -1, "s", efreet_language_get()); 155 eldbus_proxy_call(proxy, "Register", on_send_register, NULL, -1, "s", efreet_language_get());
156 156
157 /* 157 /*
158 * TODO: Needed? 158 * TODO: Needed?
159 eldbus_name_owner_changed_callback_add(conn, BUS, on_name_owner_changed, 159 eldbus_name_owner_changed_callback_add(conn, BUS, on_name_owner_changed,
160 conn, EINA_TRUE); 160 conn, EINA_TRUE);
161 */ 161 */
162 }
162 } 163 }
163 164
164 return 1; 165 return 1;
@@ -897,7 +898,8 @@ efreet_cache_desktop_add(Efreet_Desktop *desktop)
897 Eldbus_Message_Iter *iter, *array_of_string; 898 Eldbus_Message_Iter *iter, *array_of_string;
898 char *path; 899 char *path;
899 900
900 if (!efreet_cache_update) return; 901 if ((!efreet_cache_update) || (!proxy))
902 return;
901 /* TODO: Chunk updates */ 903 /* TODO: Chunk updates */
902 if (!eina_main_loop_is()) return; 904 if (!eina_main_loop_is()) return;
903 /* 905 /*
@@ -923,7 +925,8 @@ efreet_cache_icon_exts_add(Eina_List *exts)
923 Eina_List *l; 925 Eina_List *l;
924 const char *ext; 926 const char *ext;
925 927
926 if (!efreet_cache_update) return; 928 if ((!efreet_cache_update) || (!proxy))
929 return;
927 msg = eldbus_proxy_method_call_new(proxy, "AddIconExts"); 930 msg = eldbus_proxy_method_call_new(proxy, "AddIconExts");
928 iter = eldbus_message_iter_get(msg); 931 iter = eldbus_message_iter_get(msg);
929 array_of_string = eldbus_message_iter_container_new(iter, 'a',"s"); 932 array_of_string = eldbus_message_iter_container_new(iter, 'a',"s");
@@ -941,7 +944,8 @@ efreet_cache_icon_dirs_add(Eina_List *dirs)
941 Eina_List *l; 944 Eina_List *l;
942 const char *dir; 945 const char *dir;
943 946
944 if (!efreet_cache_update) return; 947 if ((!efreet_cache_update) || (!proxy))
948 return;
945 msg = eldbus_proxy_method_call_new(proxy, "AddIconDirs"); 949 msg = eldbus_proxy_method_call_new(proxy, "AddIconDirs");
946 iter = eldbus_message_iter_get(msg); 950 iter = eldbus_message_iter_get(msg);
947 array_of_string = eldbus_message_iter_container_new(iter, 'a',"s"); 951 array_of_string = eldbus_message_iter_container_new(iter, 'a',"s");
@@ -994,9 +998,9 @@ efreet_cache_desktop_close(void)
994void 998void
995efreet_cache_desktop_build(void) 999efreet_cache_desktop_build(void)
996{ 1000{
997 if (!efreet_cache_update) return; 1001 if ((!efreet_cache_update) || (!proxy))
998 if (proxy) 1002 return;
999 eldbus_proxy_call(proxy, "BuildDesktopCache", NULL, NULL, -1, "s", efreet_language_get()); 1003 eldbus_proxy_call(proxy, "BuildDesktopCache", NULL, NULL, -1, "s", efreet_language_get());
1000} 1004}
1001 1005
1002static Eina_Bool 1006static Eina_Bool