[Goodies-commits] r3398 - in xfce4-places-plugin/trunk: . panel-plugin

Diego Ongaro ongardie at xfce.org
Wed Oct 17 01:05:17 CEST 2007


Author: ongardie
Date: 2007-10-16 23:05:17 +0000 (Tue, 16 Oct 2007)
New Revision: 3398

Modified:
   xfce4-places-plugin/trunk/ChangeLog
   xfce4-places-plugin/trunk/panel-plugin/cfg.c
   xfce4-places-plugin/trunk/panel-plugin/cfg.h
   xfce4-places-plugin/trunk/panel-plugin/model_volumes.c
   xfce4-places-plugin/trunk/panel-plugin/view.c
Log:
2007-10-16	Diego Ongaro <ongardie at gmail.com>

* cfg.{c,h}, model_volumes.c, view.c: Add "Mount and Open by
default" preference (closes Bug #3565)


Modified: xfce4-places-plugin/trunk/ChangeLog
===================================================================
--- xfce4-places-plugin/trunk/ChangeLog	2007-10-16 22:41:35 UTC (rev 3397)
+++ xfce4-places-plugin/trunk/ChangeLog	2007-10-16 23:05:17 UTC (rev 3398)
@@ -7,6 +7,8 @@
 	* model_volumes.c: Added "Mount and Open" action for Bug #3565
 	* model.h, view.c: Added force_gray option to bookmarks for
 	Bug #3565
+	* cfg.{c,h}, model_volumes.c, view.c: Add "Mount and Open by
+	default" preference (closes Bug #3565)
 
 2007-10-15	Diego Ongaro <ongardie at gmail.com>
 

Modified: xfce4-places-plugin/trunk/panel-plugin/cfg.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/cfg.c	2007-10-16 22:41:35 UTC (rev 3397)
+++ xfce4-places-plugin/trunk/panel-plugin/cfg.c	2007-10-16 23:05:17 UTC (rev 3398)
@@ -78,6 +78,7 @@
     cfg->show_button_label  = FALSE;
     cfg->show_icons         = TRUE;
     cfg->show_volumes       = TRUE;
+    cfg->mount_open_volumes = FALSE;
     cfg->show_bookmarks     = TRUE;
 #if USE_RECENT_DOCUMENTS
     cfg->show_recent        = TRUE;
@@ -122,7 +123,9 @@
 
     cfg->show_icons = xfce_rc_read_bool_entry(rcfile, "show_icons", TRUE);
 
-    cfg->show_volumes   = xfce_rc_read_bool_entry(rcfile, "show_volumes", TRUE);
+    cfg->show_volumes       = xfce_rc_read_bool_entry(rcfile, "show_volumes", TRUE);
+    cfg->mount_open_volumes = xfce_rc_read_bool_entry(rcfile, "mount_open_volumes", FALSE);
+
     cfg->show_bookmarks = xfce_rc_read_bool_entry(rcfile, "show_bookmarks", TRUE);
 
     if(cfg->label != NULL)
@@ -173,6 +176,7 @@
     /* MENU */
     xfce_rc_write_bool_entry(rcfile, "show_icons", cfg->show_icons);
     xfce_rc_write_bool_entry(rcfile, "show_volumes", cfg->show_volumes);
+    xfce_rc_write_bool_entry(rcfile, "mount_open_volumes", cfg->mount_open_volumes);
     xfce_rc_write_bool_entry(rcfile, "show_bookmarks", cfg->show_bookmarks);
 #if USE_RECENT_DOCUMENTS
     xfce_rc_write_bool_entry(rcfile, "show_recent", cfg->show_recent);
@@ -414,6 +418,26 @@
     gtk_widget_show(tmp_widget);
     gtk_box_pack_start(GTK_BOX(vbox_menu), tmp_widget, FALSE, FALSE, 0);   
 
+    /* MENU: - Mount and Open (indented) */
+    tmp_box = gtk_hbox_new(FALSE, 15);
+
+    tmp_widget = gtk_label_new(" "); /* TODO: is there a more appropriate widget? */
+    gtk_widget_show(tmp_widget);
+    gtk_box_pack_start(GTK_BOX(tmp_box), tmp_widget, FALSE, FALSE, 0);
+
+    tmp_widget = gtk_check_button_new_with_mnemonic(_("Mount and Open by default"));
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tmp_widget), cfg->mount_open_volumes);
+
+    g_object_set_data(G_OBJECT(tmp_widget), "cfg_opt", &(cfg->mount_open_volumes));
+    g_signal_connect(G_OBJECT(tmp_widget), "toggled",
+                     G_CALLBACK(pcfg_model_cb), cfg);
+
+    gtk_widget_show(tmp_widget);
+    gtk_box_pack_start(GTK_BOX(tmp_box), tmp_widget, FALSE, FALSE, 0);
+    
+    gtk_widget_show(tmp_box);
+    gtk_box_pack_start(GTK_BOX(vbox_menu), tmp_box, FALSE, FALSE, 0);
+
     /* MENU: Show GTK Bookmarks */
     tmp_widget = gtk_check_button_new_with_mnemonic(_("Show GTK _bookmarks"));
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tmp_widget), cfg->show_bookmarks);

Modified: xfce4-places-plugin/trunk/panel-plugin/cfg.h
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/cfg.h	2007-10-16 22:41:35 UTC (rev 3397)
+++ xfce4-places-plugin/trunk/panel-plugin/cfg.h	2007-10-16 23:05:17 UTC (rev 3398)
@@ -38,6 +38,7 @@
     gboolean            show_button_label;
     gboolean            show_icons;
     gboolean            show_volumes;
+    gboolean            mount_open_volumes;
     gboolean            show_bookmarks;
 #if USE_RECENT_DOCUMENTS
     gboolean            show_recent;

Modified: xfce4-places-plugin/trunk/panel-plugin/model_volumes.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/model_volumes.c	2007-10-16 22:41:35 UTC (rev 3397)
+++ xfce4-places-plugin/trunk/panel-plugin/model_volumes.c	2007-10-16 23:05:17 UTC (rev 3398)
@@ -41,6 +41,7 @@
 
     ThunarVfsVolumeManager *volume_manager;
     gboolean   changed;
+    gboolean   mount_and_open_by_default;
 
 } PBVolData;
 
@@ -196,6 +197,11 @@
                 action->free    = pbvol_bookmark_action_free;
                 bookmark->actions = g_list_append(bookmark->actions, action);
 
+                if(pbg_priv(bookmark_group)->mount_and_open_by_default){
+                    bookmark->primary_action = action;
+                    bookmark->force_gray = TRUE;
+                }
+
                 g_object_ref(volume);
                 action          = g_new0(PlacesBookmarkAction, 1);
                 action->label   = _("Mount");
@@ -284,7 +290,7 @@
 }
 
 PlacesBookmarkGroup*
-places_bookmarks_volumes_create()
+places_bookmarks_volumes_create(gboolean mount_and_open_by_default)
 {
     const GList *volumes;
     PlacesBookmarkGroup *bookmark_group;
@@ -298,6 +304,7 @@
     thunar_vfs_init();
     pbg_priv(bookmark_group)->volume_manager = thunar_vfs_volume_manager_get_default();
     pbg_priv(bookmark_group)->changed        = TRUE;
+    pbg_priv(bookmark_group)->mount_and_open_by_default = mount_and_open_by_default;
     
     volumes = thunar_vfs_volume_manager_get_volumes(pbg_priv(bookmark_group)->volume_manager);
     while(volumes != NULL){

Modified: xfce4-places-plugin/trunk/panel-plugin/view.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/view.c	2007-10-16 22:41:35 UTC (rev 3397)
+++ xfce4-places-plugin/trunk/panel-plugin/view.c	2007-10-16 23:05:17 UTC (rev 3398)
@@ -183,7 +183,7 @@
     view->bookmark_groups = g_list_append(view->bookmark_groups, places_bookmarks_system_create());
 
     if(view->cfg->show_volumes)
-        view->bookmark_groups = g_list_append(view->bookmark_groups, places_bookmarks_volumes_create());
+        view->bookmark_groups = g_list_append(view->bookmark_groups, places_bookmarks_volumes_create(view->cfg->mount_open_volumes));
 
     if(view->cfg->show_bookmarks){
         view->bookmark_groups = g_list_append(view->bookmark_groups, NULL); /* separator */




More information about the Goodies-commits mailing list