[anjuta] search: Remove "Find files" button and instead reuse the search button for this feature.
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] search: Remove "Find files" button and instead reuse the search button for this feature.
- Date: Mon, 13 Feb 2012 19:51:20 +0000 (UTC)
commit f840391537f71102491c507d8a650479a1cc97ea
Author: Johannes Schmid <jhs gnome org>
Date: Mon Feb 13 20:48:22 2012 +0100
search: Remove "Find files" button and instead reuse the search button for this feature.
Also align the buttons correctly and rename "Replace" to "Replace All"
.../document-manager/anjuta-document-manager.ui | 106 ++++++++++----------
plugins/document-manager/search-files.c | 34 +++----
2 files changed, 67 insertions(+), 73 deletions(-)
---
diff --git a/plugins/document-manager/anjuta-document-manager.ui b/plugins/document-manager/anjuta-document-manager.ui
index cdae3a1..cdcfa9b 100644
--- a/plugins/document-manager/anjuta-document-manager.ui
+++ b/plugins/document-manager/anjuta-document-manager.ui
@@ -373,6 +373,7 @@
<property name="invisible_char_set">True</property>
<property name="primary_icon_stock">gtk-find</property>
<signal name="changed" handler="search_files_update_ui" swapped="yes"/>
+ <signal name="activate" handler="search_files_search_clicked" swapped="yes"/>
</object>
<packing>
<property name="left_attach">0</property>
@@ -399,43 +400,6 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="search_button">
- <property name="label">gtk-find</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="halign">start</property>
- <property name="valign">start</property>
- <property name="use_action_appearance">False</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="search_files_search_clicked" swapped="yes"/>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="replace_button">
- <property name="label" translatable="yes">Replace</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="halign">start</property>
- <property name="valign">start</property>
- <property name="use_action_appearance">False</property>
- <signal name="clicked" handler="search_files_replace_clicked" swapped="yes"/>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -530,24 +494,6 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="find_files_button">
- <property name="label" translatable="yes">Find Files</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="halign">start</property>
- <property name="valign">start</property>
- <property name="use_action_appearance">False</property>
- <signal name="clicked" handler="search_files_find_files_clicked" swapped="yes"/>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -574,6 +520,56 @@
</packing>
</child>
<child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">start</property>
+ <property name="row_spacing">5</property>
+ <property name="column_spacing">5</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">1</property>
+ <child>
+ <object class="GtkButton" id="search_button">
+ <property name="label">gtk-find</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="search_files_search_clicked" swapped="yes"/>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="replace_button">
+ <property name="label" translatable="yes">Replace All</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <signal name="clicked" handler="search_files_replace_clicked" swapped="yes"/>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">2</property>
+ </packing>
+ </child>
+ <child>
<placeholder/>
</child>
</object>
diff --git a/plugins/document-manager/search-files.c b/plugins/document-manager/search-files.c
index 15043a9..5ee28ff 100644
--- a/plugins/document-manager/search-files.c
+++ b/plugins/document-manager/search-files.c
@@ -37,7 +37,6 @@ struct _SearchFilesPrivate
GtkWidget* search_button;
GtkWidget* replace_button;
- GtkWidget* find_files_button;
GtkWidget* search_entry;
GtkWidget* replace_entry;
@@ -94,15 +93,15 @@ enum
G_DEFINE_TYPE (SearchFiles, search_files, G_TYPE_OBJECT);
-void search_files_search_clicked (SearchFiles* sf);
-void search_files_replace_clicked (SearchFiles* sf);
-void search_files_find_files_clicked (SearchFiles* sf);
-void search_files_update_ui (SearchFiles* sf);
+G_MODULE_EXPORT void search_files_search_clicked (SearchFiles* sf);
+G_MODULE_EXPORT void search_files_replace_clicked (SearchFiles* sf);
+G_MODULE_EXPORT void search_files_update_ui (SearchFiles* sf);
void
search_files_update_ui (SearchFiles* sf)
{
GtkTreeIter iter;
+ gboolean can_replace = FALSE;
gboolean can_search = FALSE;
if (!sf->priv->busy)
@@ -110,8 +109,10 @@ search_files_update_ui (SearchFiles* sf)
gtk_spinner_stop(GTK_SPINNER (sf->priv->spinner_busy));
gtk_widget_hide (sf->priv->spinner_busy);
- if (strlen(gtk_entry_get_text (GTK_ENTRY (sf->priv->search_entry))) > 0
- && gtk_tree_model_get_iter_first(sf->priv->files_model, &iter))
+ can_search =
+ strlen(gtk_entry_get_text (GTK_ENTRY (sf->priv->search_entry))) > 0;
+
+ if (gtk_tree_model_get_iter_first(sf->priv->files_model, &iter))
{
do
{
@@ -134,8 +135,9 @@ search_files_update_ui (SearchFiles* sf)
}
gtk_widget_set_sensitive (sf->priv->search_button, can_search);
- gtk_widget_set_sensitive (sf->priv->replace_button, can_search);
- gtk_widget_set_sensitive (sf->priv->find_files_button, !sf->priv->busy);
+ gtk_widget_set_sensitive (sf->priv->replace_button, can_replace);
+ gtk_widget_set_sensitive (sf->priv->search_entry, !sf->priv->busy);
+ gtk_widget_set_sensitive (sf->priv->replace_entry, !sf->priv->busy);
}
static void
@@ -166,9 +168,8 @@ search_files_check_column_toggled (GtkCellRendererToggle* renderer,
static void
search_files_finished (SearchFiles* sf, AnjutaCommandQueue* queue)
{
- sf->priv->busy = FALSE;
g_object_unref (queue);
-
+ sf->priv->busy = FALSE;
search_files_update_ui(sf);
}
@@ -208,8 +209,8 @@ search_files_command_finished (SearchFileCommand* cmd,
g_object_unref (cmd);
}
-void
-search_files_search_clicked (SearchFiles* sf)
+static void
+search_files_search (SearchFiles* sf)
{
GtkTreeIter iter;
@@ -411,12 +412,11 @@ search_files_filter_finished (AnjutaCommandQueue* queue,
SearchFiles* sf)
{
g_object_unref (queue);
- sf->priv->busy = FALSE;
- search_files_update_ui(sf);
+ search_files_search (sf);
}
void
-search_files_find_files_clicked (SearchFiles* sf)
+search_files_search_clicked (SearchFiles* sf)
{
GFile* selected;
IAnjutaProjectManager* pm;
@@ -785,8 +785,6 @@ search_files_init (SearchFiles* sf)
"search_button"));
sf->priv->replace_button = GTK_WIDGET (gtk_builder_get_object(sf->priv->builder,
"replace_button"));
- sf->priv->find_files_button = GTK_WIDGET (gtk_builder_get_object(sf->priv->builder,
- "find_files_button"));
sf->priv->search_entry = GTK_WIDGET (gtk_builder_get_object(sf->priv->builder,
"search_entry"));
sf->priv->replace_entry = GTK_WIDGET (gtk_builder_get_object(sf->priv->builder,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]