Codebase list xapp / 6cb172d
xapp-gtk3-module.c: Don't add a favorites section if there aren't any favorites. Michael Webster 3 years ago
1 changed file(s) with 17 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
2323 xapp_sidebar_constructed (GObject *object)
2424 {
2525 GtkPlacesSidebar *sidebar = GTK_PLACES_SIDEBAR (object);
26 GSettings *fav_settings;
27 gchar **list;
2628
2729 (* original_sidebar_constructed) (object);
2830
29 GFile *favorites = g_file_new_for_uri ("favorites:///");
30 gtk_places_sidebar_add_shortcut (sidebar, favorites);
31 g_object_unref (favorites);
31 // This is better than initializing favorites to count.
32 // That way if there aren't any favorites, fav_settings
33 // will go away. XAppFavorites is a singleton.
34 fav_settings = g_settings_new ("org.x.apps.favorites");
35 list = g_settings_get_strv (fav_settings, "list");
36
37 if (g_strv_length (list) > 0)
38 {
39 GFile *favorites = g_file_new_for_uri ("favorites:///");
40 gtk_places_sidebar_add_shortcut (sidebar, favorites);
41 g_object_unref (favorites);
42 }
43
44 g_strfreev (list);
45 g_object_unref (fav_settings);
3246 }
3347
3448 G_MODULE_EXPORT void gtk_module_init (gint *argc, gchar ***argv[]) {