[Goodies-commits] r2807 - in xfce4-places-plugin/trunk: . panel-plugin
Diego Ongaro
ongardie at xfce.org
Sun Jun 3 09:45:50 CEST 2007
Author: ongardie
Date: 2007-06-03 07:45:49 +0000 (Sun, 03 Jun 2007)
New Revision: 2807
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/places.c
xfce4-places-plugin/trunk/panel-plugin/places.h
xfce4-places-plugin/trunk/panel-plugin/view.c
Log:
2007-06-03 Diego Ongaro <ongardie at gmail.com>
* Added optional search command
Modified: xfce4-places-plugin/trunk/ChangeLog
===================================================================
--- xfce4-places-plugin/trunk/ChangeLog 2007-06-03 06:53:34 UTC (rev 2806)
+++ xfce4-places-plugin/trunk/ChangeLog 2007-06-03 07:45:49 UTC (rev 2807)
@@ -1,3 +1,8 @@
+2007-06-03 Diego Ongaro <ongardie at gmail.com>
+
+ * Added optional search command
+ * Use thunar-vfs to get and update trash icon (empty/full)
+
2007-05-22 Diego Ongaro <ongardie at gmail.com>
* Changed to lazily adding menu separators to avoid extra
Modified: xfce4-places-plugin/trunk/panel-plugin/cfg.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/cfg.c 2007-06-03 06:53:34 UTC (rev 2806)
+++ xfce4-places-plugin/trunk/panel-plugin/cfg.c 2007-06-03 07:45:49 UTC (rev 2807)
@@ -72,6 +72,7 @@
cfg->show_recent_clear = TRUE;
cfg->show_recent_number = 10;
#endif
+ cfg->search_cmd = NULL;
if(cfg->label != NULL)
g_free(cfg->label);
@@ -96,6 +97,8 @@
{
if(pd->cfg->label != NULL)
g_free(pd->cfg->label);
+ if(pd->cfg->search_cmd != NULL)
+ g_free(pd->cfg->search_cmd);
}
/********** Configuration File **********/
@@ -140,6 +143,8 @@
cfg->label = _("Places");
cfg->label = g_strdup(cfg->label);
+ cfg->search_cmd = g_strdup(xfce_rc_read_entry(rcfile, "search_cmd", NULL));
+
#if USE_RECENT_DOCUMENTS
cfg->show_recent = xfce_rc_read_bool_entry(rcfile, "show_recent", TRUE);
cfg->show_recent_clear = xfce_rc_read_bool_entry(rcfile, "show_recent_clear", TRUE);
@@ -185,6 +190,8 @@
xfce_rc_write_int_entry(rcfile, "show_recent_number", cfg->show_recent_number);
#endif
+ xfce_rc_write_entry(rcfile, "search_cmd", cfg->search_cmd);
+
xfce_rc_close(rcfile);
DBG("configuration saved");
@@ -269,6 +276,23 @@
return FALSE;
}
+static gboolean
+places_cfg_search_cmd_cb(GtkWidget *label_entry, GdkEventFocus *event, PlacesData *pd)
+{
+ if(pd->cfg->search_cmd != NULL)
+ g_free(pd->cfg->search_cmd);
+
+ pd->cfg->search_cmd = g_strstrip(g_strdup(gtk_entry_get_text(GTK_ENTRY(label_entry))));
+ if(*(pd->cfg->search_cmd) == '\0'){
+ g_free(pd->cfg->search_cmd);
+ pd->cfg->search_cmd = NULL;
+ }
+
+ places_view_destroy_menu(pd);
+
+ return FALSE;
+}
+
#if USE_RECENT_DOCUMENTS
static void
places_cfg_recent_num_cb(GtkAdjustment *adj, PlacesData *pd)
@@ -320,6 +344,7 @@
#if USE_RECENT_DOCUMENTS
GtkWidget *frame_recent, *vbox_recent;
#endif
+ GtkWidget *frame_search, *vbox_search;
GtkWidget *tmp_box, *tmp_label, *tmp_widget;
gint active;
@@ -488,6 +513,32 @@
gtk_box_pack_start(GTK_BOX(tmp_box), tmp_widget, FALSE, FALSE, 0);
#endif
+ // Search: frame, vbox
+ vbox_search = gtk_vbox_new(FALSE, 4);
+ gtk_widget_show(vbox_search);
+
+ frame_search = xfce_create_framebox_with_content(_("Search"), vbox_search);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->vbox), frame_search, FALSE, FALSE, 0);
+
+ // Search: command
+ tmp_box = gtk_hbox_new(FALSE, 15);
+ gtk_widget_show(tmp_box);
+ gtk_box_pack_start(GTK_BOX(vbox_search), tmp_box, FALSE, FALSE, 0);
+
+ tmp_label = gtk_label_new_with_mnemonic(_("Co_mmand"));
+ gtk_widget_show(tmp_label);
+ gtk_box_pack_start(GTK_BOX(tmp_box), tmp_label, FALSE, FALSE, 0);
+
+ tmp_widget = gtk_entry_new();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(tmp_label), tmp_widget);
+ gtk_entry_set_text(GTK_ENTRY(tmp_widget), cfg->search_cmd);
+
+ g_signal_connect(G_OBJECT(tmp_widget), "focus-out-event",
+ G_CALLBACK(places_cfg_search_cmd_cb), pd);
+
+ gtk_widget_show(tmp_widget);
+ gtk_box_pack_start(GTK_BOX(tmp_box), tmp_widget, FALSE, FALSE, 0);
+
gtk_widget_show(dlg);
}
Modified: xfce4-places-plugin/trunk/panel-plugin/cfg.h
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/cfg.h 2007-06-03 06:53:34 UTC (rev 2806)
+++ xfce4-places-plugin/trunk/panel-plugin/cfg.h 2007-06-03 07:45:49 UTC (rev 2807)
@@ -34,6 +34,7 @@
gboolean show_recent;
gboolean show_recent_clear;
gint show_recent_number;
+ gchar *search_cmd;
} PlacesConfig;
// Init & Finalize
Modified: xfce4-places-plugin/trunk/panel-plugin/places.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/places.c 2007-06-03 06:53:34 UTC (rev 2806)
+++ xfce4-places-plugin/trunk/panel-plugin/places.c 2007-06-03 07:45:49 UTC (rev 2807)
@@ -103,13 +103,20 @@
gchar *cmd = g_strconcat("thunar \"", path, "\"", NULL);
DBG("exec: %s", cmd);
- xfce_exec(cmd, FALSE, TRUE, NULL);
+ places_gui_exec(cmd);
g_free(cmd);
}else{
DBG("exec: thunar");
- xfce_exec("thunar", FALSE, TRUE, NULL);
+ places_gui_exec("thunar");
}
}
+void
+places_gui_exec(const gchar *cmd)
+{
+ if(cmd != NULL)
+ xfce_exec(cmd, FALSE, TRUE, NULL);
+}
+
// vim: ai et tabstop=4
Modified: xfce4-places-plugin/trunk/panel-plugin/places.h
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/places.h 2007-06-03 06:53:34 UTC (rev 2806)
+++ xfce4-places-plugin/trunk/panel-plugin/places.h 2007-06-03 07:45:49 UTC (rev 2807)
@@ -52,6 +52,8 @@
};
void places_load_thunar(const gchar*);
+void places_gui_exec(const gchar *cmd);
+
#endif
// vim: ai et tabstop=4
Modified: xfce4-places-plugin/trunk/panel-plugin/view.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/view.c 2007-06-03 06:53:34 UTC (rev 2806)
+++ xfce4-places-plugin/trunk/panel-plugin/view.c 2007-06-03 07:45:49 UTC (rev 2807)
@@ -79,7 +79,6 @@
const gchar *label, const gchar *uri, const gchar *icon);
static void places_view_lazy_add_menu_sep(gpointer _places_data);
-
/********** Initialization & Finalization **********/
void
@@ -214,11 +213,29 @@
// Recent Documents
#if USE_RECENT_DOCUMENTS
- if(pd->cfg->show_recent){
-
+ if(pd->cfg->show_recent || pd->cfg->search_cmd != NULL){
+#else
+ if(pd->cfg->search_cmd != NULL){
+#endif
gtk_menu_shell_append(GTK_MENU_SHELL(pd->view_menu),
gtk_separator_menu_item_new());
-
+ }
+
+ if(pd->cfg->search_cmd != NULL){
+ GtkWidget *search_item = gtk_image_menu_item_new_with_mnemonic(_("Search for Files"));
+ if(pd->cfg->show_icons){
+ GtkWidget *search_image = gtk_image_new_from_icon_name("system-search", GTK_ICON_SIZE_MENU);
+ gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(search_item), search_image);
+ }
+ gtk_menu_shell_append(GTK_MENU_SHELL(pd->view_menu), search_item);
+ g_signal_connect_swapped(search_item, "activate",
+ G_CALLBACK(places_gui_exec), pd->cfg->search_cmd);
+
+ }
+
+#if USE_RECENT_DOCUMENTS
+ if(pd->cfg->show_recent){
+
recent_menu = gtk_recent_chooser_menu_new();
gtk_recent_chooser_set_show_icons(GTK_RECENT_CHOOSER(recent_menu), pd->cfg->show_icons);
gtk_recent_chooser_set_limit(GTK_RECENT_CHOOSER(recent_menu), pd->cfg->show_recent_number);
More information about the Goodies-commits
mailing list