[file-roller] moved the find action on the toolbar
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller] moved the find action on the toolbar
- Date: Mon, 3 Dec 2012 18:39:05 +0000 (UTC)
commit 82b918d2ce97ff004f944df3fa56b868e40d98a2
Author: Paolo Bacchilega <paobac src gnome org>
Date: Mon Dec 3 14:10:05 2012 +0100
moved the find action on the toolbar
and moved the filter bar on top
src/actions.c | 2 +-
src/fr-window.c | 90 +++++++++++++++++++++++++---------------------
src/fr-window.h | 3 +-
src/ui.h | 11 +++---
src/ui/menus-toolbars.ui | 2 +
5 files changed, 60 insertions(+), 48 deletions(-)
---
diff --git a/src/actions.c b/src/actions.c
index f91911e..0e9a19f 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -312,7 +312,7 @@ activate_action_find (GtkAction *action,
{
FrWindow *window = data;
- fr_window_find (window);
+ fr_window_find (window, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
}
diff --git a/src/fr-window.c b/src/fr-window.c
index 00bf7d3..d22990f 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -1730,6 +1730,16 @@ get_tree_iter_from_path (FrWindow *window,
static void
+fr_window_deactivate_filter (FrWindow *window)
+{
+ GtkAction *action;
+
+ action = gtk_action_group_get_action (window->priv->actions, "Find");
+ g_object_set (action, "active", FALSE, NULL);
+}
+
+
+static void
fr_window_update_current_location (FrWindow *window)
{
const char *current_dir = fr_window_get_current_location (window);
@@ -1753,6 +1763,8 @@ fr_window_update_current_location (FrWindow *window)
gtk_widget_set_sensitive (window->priv->location_label, window->priv->archive_present);
gtk_widget_set_sensitive (window->priv->filter_entry, window->priv->archive_present);
+ fr_window_deactivate_filter (window);
+
#if 0
fr_window_history_print (window);
#endif
@@ -1904,19 +1916,6 @@ fr_window_update_dir_tree (FrWindow *window)
static void
-fr_window_update_filter_bar_visibility (FrWindow *window)
-{
- const char *filter;
-
- filter = gtk_entry_get_text (GTK_ENTRY (window->priv->filter_entry));
- if ((filter == NULL) || (*filter == '\0'))
- gtk_widget_hide (window->priv->filter_bar);
- else
- gtk_widget_show (window->priv->filter_bar);
-}
-
-
-static void
fr_window_update_file_list (FrWindow *window,
gboolean update_view)
{
@@ -4497,24 +4496,6 @@ fr_window_update_columns_visibility (FrWindow *window)
}
-static void
-fr_window_deactivate_filter (FrWindow *window)
-{
- window->priv->filter_mode = FALSE;
- window->priv->list_mode = window->priv->last_list_mode;
-
- gtk_entry_set_text (GTK_ENTRY (window->priv->filter_entry), "");
- fr_window_update_filter_bar_visibility (window);
-
- gtk_list_store_clear (window->priv->list_store);
-
- fr_window_update_columns_visibility (window);
- fr_window_update_file_list (window, TRUE);
- fr_window_update_dir_tree (window);
- fr_window_update_current_location (window);
-}
-
-
static gboolean
key_press_cb (GtkWidget *widget,
GdkEventKey *event,
@@ -5036,7 +5017,7 @@ fr_window_show_cb (GtkWidget *widget,
window->priv->view_folders = g_settings_get_boolean (window->priv->settings_ui, PREF_UI_VIEW_FOLDERS);
set_active (window, "ViewFolders", window->priv->view_folders);
- fr_window_update_filter_bar_visibility (window);
+ gtk_widget_hide (window->priv->filter_bar);
return TRUE;
}
@@ -5275,7 +5256,7 @@ fr_window_activate_filter (FrWindow *window)
GtkTreeView *tree_view = GTK_TREE_VIEW (window->priv->list_view);
GtkTreeViewColumn *column;
- fr_window_update_filter_bar_visibility (window);
+ gtk_widget_show (window->priv->filter_bar);
window->priv->list_mode = FR_WINDOW_LIST_MODE_FLAT;
gtk_list_store_clear (window->priv->list_store);
@@ -5332,16 +5313,16 @@ fr_window_attach (FrWindow *window,
case FR_WINDOW_AREA_LOCATIONBAR:
position = 2;
break;
- case FR_WINDOW_AREA_CONTENTS:
+ case FR_WINDOW_AREA_FILTERBAR:
position = 3;
+ break;
+ case FR_WINDOW_AREA_CONTENTS:
+ position = 4;
if (window->priv->contents != NULL)
gtk_widget_destroy (window->priv->contents);
window->priv->contents = child;
gtk_widget_set_vexpand (child, TRUE);
break;
- case FR_WINDOW_AREA_FILTERBAR:
- position = 4;
- break;
case FR_WINDOW_AREA_STATUSBAR:
position = 5;
break;
@@ -5387,6 +5368,7 @@ fr_window_construct (FrWindow *window)
GtkAction *action;
GtkAction *other_actions_action;
GtkUIManager *ui;
+ GtkSizeGroup *toolbar_size_group;
GError *error = NULL;
const char * const *schemas;
@@ -5598,6 +5580,7 @@ fr_window_construct (FrWindow *window)
/* filter bar */
window->priv->filter_bar = filter_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ g_object_set (window->priv->filter_bar, "margin-left", 6, NULL);
gtk_container_set_border_width (GTK_CONTAINER (filter_box), 3);
fr_window_attach (FR_WINDOW (window), window->priv->filter_bar, FR_WINDOW_AREA_FILTERBAR);
@@ -5887,6 +5870,12 @@ fr_window_construct (FrWindow *window)
/**/
+ toolbar_size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
+ gtk_size_group_add_widget (toolbar_size_group, window->priv->location_bar);
+ gtk_size_group_add_widget (toolbar_size_group, window->priv->filter_bar);
+
+ /**/
+
fr_window_update_title (window);
fr_window_update_sensitivity (window);
fr_window_update_current_location (window);
@@ -7195,11 +7184,30 @@ fr_window_get_list_store (FrWindow *window)
void
-fr_window_find (FrWindow *window)
+fr_window_find (FrWindow *window,
+ gboolean active)
{
- window->priv->filter_mode = TRUE;
- gtk_widget_show (window->priv->filter_bar);
- gtk_widget_grab_focus (window->priv->filter_entry);
+ if (active) {
+ window->priv->filter_mode = TRUE;
+ gtk_widget_show (window->priv->filter_bar);
+ gtk_widget_hide (window->priv->location_bar);
+ gtk_widget_grab_focus (window->priv->filter_entry);
+ }
+ else {
+ window->priv->filter_mode = FALSE;
+ window->priv->list_mode = window->priv->last_list_mode;
+
+ gtk_entry_set_text (GTK_ENTRY (window->priv->filter_entry), "");
+ gtk_widget_hide (window->priv->filter_bar);
+
+ gtk_list_store_clear (window->priv->list_store);
+
+ fr_window_update_columns_visibility (window);
+ fr_window_update_file_list (window, TRUE);
+ fr_window_update_dir_tree (window);
+ fr_window_update_current_location (window);
+ fr_window_go_to_location (window, gtk_entry_get_text (GTK_ENTRY (window->priv->location_entry)), FALSE);
+ }
}
diff --git a/src/fr-window.h b/src/fr-window.h
index 95a31de..eced086 100644
--- a/src/fr-window.h
+++ b/src/fr-window.h
@@ -208,7 +208,8 @@ GList * fr_window_get_selection (FrWindow *window,
gboolean from_sidebar,
char **return_base_dir);
GtkTreeModel * fr_window_get_list_store (FrWindow *window);
-void fr_window_find (FrWindow *window);
+void fr_window_find (FrWindow *window,
+ gboolean active);
void fr_window_select_all (FrWindow *window);
void fr_window_unselect_all (FrWindow *window);
diff --git a/src/ui.h b/src/ui.h
index 595b110..988d5c1 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -114,11 +114,6 @@ static GtkActionEntry action_entries[] = {
N_("Extract"), NULL,
N_("Extract files from the archive"),
G_CALLBACK (activate_action_extract) },
- { "Find", GTK_STOCK_FIND,
- N_("Findâ"), NULL,
- NULL,
- G_CALLBACK (activate_action_find) },
-
{ "New", GTK_STOCK_NEW,
N_("Newâ"), NULL,
N_("Create a new archive"),
@@ -213,6 +208,12 @@ static GtkToggleActionEntry action_toggle_entries[] = {
N_("View the folders pane"),
G_CALLBACK (activate_action_view_folders),
FALSE },
+ { "Find", GTK_STOCK_FIND,
+ N_("Findâ"), NULL,
+ N_("Find files by name"),
+ G_CALLBACK (activate_action_find),
+ FALSE },
+
};
static guint n_action_toggle_entries = G_N_ELEMENTS (action_toggle_entries);
diff --git a/src/ui/menus-toolbars.ui b/src/ui/menus-toolbars.ui
index 30532cb..d5bcdd7 100644
--- a/src/ui/menus-toolbars.ui
+++ b/src/ui/menus-toolbars.ui
@@ -49,6 +49,8 @@
<separator/>
<toolitem action="Add_Toolbar"/>
<toolitem action="Extract_Toolbar"/>
+ <separator/>
+ <toolitem action="Find"/>
<separator expand="true"/>
<toolitem action="OtherActions"/>
</toolbar>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]