[easytag/wip/musicbrainz-support-merge: 65/71] Removed Up, Down and Search in treeView entry
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/musicbrainz-support-merge: 65/71] Removed Up, Down and Search in treeView entry
- Date: Sun, 31 Aug 2014 20:20:03 +0000 (UTC)
commit dadbe56c0546e94454d49f1c671bd394f94a5b0b
Author: Abhinav <abhijangda hotmail com>
Date: Fri Aug 15 20:09:04 2014 +0530
Removed Up, Down and Search in treeView entry
data/musicbrainz_dialog.ui | 102 +++---------------------------
src/mbentityview.c | 145 +++-----------------------------------------
src/musicbrainz_dialog.c | 78 +-----------------------
3 files changed, 21 insertions(+), 304 deletions(-)
---
diff --git a/data/musicbrainz_dialog.ui b/data/musicbrainz_dialog.ui
index f8dd330..f2b6c94 100644
--- a/data/musicbrainz_dialog.ui
+++ b/data/musicbrainz_dialog.ui
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
- <object class="GtkImage" id="img_invert_selection">
+ <object class="GtkImage" id="findimage">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="stock">easytag-invert-selection</property>
+ <property name="stock">gtk-find</property>
</object>
<object class="GtkImage" id="img_red_lines">
<property name="visible">True</property>
@@ -16,10 +16,10 @@
<property name="can_focus">False</property>
<property name="stock">easytag-unselect-all</property>
</object>
- <object class="GtkImage" id="findimage">
+ <object class="GtkImage" id="img_invert_selection">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="stock">gtk-find</property>
+ <property name="stock">easytag-invert-selection</property>
</object>
<object class="GtkBox" id="mb_box">
<property name="visible">True</property>
@@ -180,86 +180,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkToolItem" id="toolbutton1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Search:</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolItem" id="toolbutton2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkEntry" id="entry_tree_view_search">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="invisible_char_set">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolButton" id="toolbtn_up">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">False</property>
- <property name="has_tooltip">True</property>
- <property name="tooltip_markup" translatable="yes">Up</property>
- <property name="tooltip_text" translatable="yes">Up</property>
- <property name="label" translatable="yes">toolbutton3</property>
- <property name="use_underline">True</property>
- <property name="stock_id">gtk-go-up</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolButton" id="toolbtn_down">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">False</property>
- <property name="has_tooltip">True</property>
- <property name="tooltip_markup" translatable="yes">Down</property>
- <property name="tooltip_text" translatable="yes">Down</property>
- <property name="label" translatable="yes">toolbutton3</property>
- <property name="use_underline">True</property>
- <property name="stock_id">gtk-go-down</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkSeparatorToolItem" id="toolbutton4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
<object class="GtkToolButton" id="toolbtn_invert_selection">
<property name="visible">True</property>
<property name="sensitive">False</property>
@@ -272,7 +192,7 @@
<property name="icon_widget">img_invert_selection</property>
</object>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="homogeneous">True</property>
</packing>
</child>
@@ -289,7 +209,7 @@
<property name="stock_id">gtk-select-all</property>
</object>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="homogeneous">True</property>
</packing>
</child>
@@ -306,7 +226,7 @@
<property name="icon_widget">img_unselect_all</property>
</object>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="homogeneous">True</property>
</packing>
</child>
@@ -323,7 +243,7 @@
<property name="icon_widget">img_red_lines</property>
</object>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="homogeneous">True</property>
</packing>
</child>
@@ -340,7 +260,7 @@
<property name="stock_id">gtk-refresh</property>
</object>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="homogeneous">True</property>
</packing>
</child>
@@ -354,7 +274,7 @@
<property name="stock_id">gtk-cancel</property>
</object>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="homogeneous">True</property>
</packing>
</child>
@@ -368,7 +288,7 @@
<property name="stock_id">gtk-save</property>
</object>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="homogeneous">True</property>
</packing>
</child>
diff --git a/src/mbentityview.c b/src/mbentityview.c
index 8951e70..45ab060 100644
--- a/src/mbentityview.c
+++ b/src/mbentityview.c
@@ -37,18 +37,6 @@ G_DEFINE_TYPE (EtMbEntityView, et_mb_entity_view, GTK_TYPE_BOX)
/***************
* Declaration *
***************/
-/*
- * ET_MB_DISPLAY_RESULTS:
- * @ET_MB_DISPLAY_RESULTS_ALL: Display all results.
- * @ET_MB_DISPLAY_RESULTS_RED: Display Red Lines
- * @ET_MB_DISPLAY_RESULTS_SEARCH: Display Search Results
- */
-enum ET_MB_DISPLAY_RESULTS
-{
- ET_MB_DISPLAY_RESULTS_ALL = 0,
- ET_MB_DISPLAY_RESULTS_RED = 1,
- ET_MB_DISPLAY_RESULTS_SEARCH = 1 << 1,
-};
/*
* EtMbEntityViewPrivate:
@@ -61,7 +49,6 @@ enum ET_MB_DISPLAY_RESULTS
* @mb_tree_current_node: Current node being displayed by EtMbEntityView
* @active_toggle_button: Current active GtkToggleToolButton
* @filter: GtkTreeModelFilter to filter rows based on the conditions
- * @search_or_red: Toggle Red Lines or Search in results
* @toggle_red_lines: Display Red Lines or not
* @text_to_search_in_results: Text to search in results
*
@@ -78,7 +65,6 @@ struct _EtMbEntityViewPrivate
GNode *mb_tree_current_node;
GtkWidget *active_toggle_button;
GtkTreeModel *filter;
- int search_or_red;
gboolean toggle_red_lines;
const gchar *text_to_search_in_results;
GtkTreeViewColumn *color_column;
@@ -147,30 +133,8 @@ tree_filter_visible_func (GtkTreeModel *model, GtkTreeIter *iter,
columns = gtk_tree_model_get_n_columns (model);
priv = (EtMbEntityViewPrivate *)data;
-
- if (priv->search_or_red == ET_MB_DISPLAY_RESULTS_ALL)
- {
- /* Display all results */
- return TRUE;
- }
-
- if (priv->search_or_red & ET_MB_DISPLAY_RESULTS_SEARCH)
- {
- /* Display results corresponding to search text only */
- gchar *value;
-
- gtk_tree_model_get (model, iter, 0, &value, -1);
-
- if (g_strstr_len (value, -1, priv->text_to_search_in_results))
- {
- g_free (value);
- return TRUE;
- }
-
- g_free (value);
- }
-
- if (priv->search_or_red & ET_MB_DISPLAY_RESULTS_RED)
+
+ if (!priv->toggle_red_lines)
{
/* Display Red Results only */
GdkRGBA *value;
@@ -202,10 +166,10 @@ tree_filter_visible_func (GtkTreeModel *model, GtkTreeIter *iter,
return TRUE;
}
- return priv->toggle_red_lines;
+ return FALSE;
}
- return FALSE;
+ return TRUE;
}
/*
@@ -988,7 +952,6 @@ et_mb_entity_view_init (EtMbEntityView *entity_view)
gtk_box_pack_start (GTK_BOX (entity_view), priv->scrolled_window,
TRUE, TRUE, 2);
priv->toggle_red_lines = TRUE;
- priv->search_or_red = ET_MB_DISPLAY_RESULTS_ALL;
g_signal_connect (G_OBJECT (priv->tree_view), "row-activated",
G_CALLBACK (tree_view_row_activated), entity_view);
}
@@ -1121,7 +1084,6 @@ et_mb_entity_view_toggle_red_lines (EtMbEntityView *entity_view)
EtMbEntityViewPrivate *priv;
priv = ET_MB_ENTITY_VIEW_GET_PRIVATE (entity_view);
- priv->search_or_red = priv->search_or_red | ET_MB_DISPLAY_RESULTS_RED;
priv->toggle_red_lines = !priv->toggle_red_lines;
g_return_if_fail (priv->filter);
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (priv->filter));
@@ -1185,99 +1147,6 @@ et_mb_entity_view_get_current_level (EtMbEntityView *entity_view)
}
/*
- * et_mb_entity_view_search_in_results:
- * @entity_view: EtMbEntityView
- *
- * To search in the results obtained
- */
-void
-et_mb_entity_view_search_in_results (EtMbEntityView *entity_view,
- const gchar *text)
-{
- EtMbEntityViewPrivate *priv;
-
- priv = ET_MB_ENTITY_VIEW_GET_PRIVATE (entity_view);
- priv->text_to_search_in_results = text;
- priv->search_or_red = priv->search_or_red | ET_MB_DISPLAY_RESULTS_SEARCH;
- g_return_if_fail (priv->filter);
- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (priv->filter));
-}
-
-/*
- * et_mb_entity_view_select_up:
- * @entity_view: EtMbEntityView
- *
- * To select the row above the current row.
- */
-void
-et_mb_entity_view_select_up (EtMbEntityView *entity_view)
-{
- EtMbEntityViewPrivate *priv;
- GtkTreeSelection *selection;
- GtkTreeIter iter;
- GList *selected_rows;
-
- priv = ET_MB_ENTITY_VIEW_GET_PRIVATE (entity_view);
- g_return_if_fail (priv->filter);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree_view));
- selected_rows = gtk_tree_selection_get_selected_rows (selection,
- &priv->filter);
- if (!selected_rows)
- {
- return;
- }
-
- gtk_tree_model_get_iter (priv->filter, &iter,
- (g_list_first (selected_rows)->data));
- if (!gtk_tree_model_iter_previous (priv->filter, &iter))
- {
- goto exit;
- }
-
- gtk_tree_selection_select_iter (selection, &iter);
-
- exit:
- g_list_free_full (selected_rows, (GDestroyNotify)gtk_tree_path_free);
-}
-
-/*
- * et_mb_entity_view_select_down:
- * @entity_view: EtMbEntityView
- *
- * To select the row below the current row.
- */
-void
-et_mb_entity_view_select_down (EtMbEntityView *entity_view)
-{
- EtMbEntityViewPrivate *priv;
- GtkTreeSelection *selection;
- GtkTreeIter iter;
- GList *selected_rows;
-
- priv = ET_MB_ENTITY_VIEW_GET_PRIVATE (entity_view);
- g_return_if_fail (priv->filter);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree_view));
- selected_rows = gtk_tree_selection_get_selected_rows (selection,
- &priv->filter);
- if (!selected_rows)
- {
- return;
- }
-
- gtk_tree_model_get_iter (priv->filter, &iter,
- g_list_last (selected_rows)->data);
- if (!gtk_tree_model_iter_next (priv->filter, &iter))
- {
- goto exit;
- }
-
- gtk_tree_selection_select_iter (selection, &iter);
-
- exit:
- g_list_free_full (selected_rows, (GDestroyNotify)gtk_tree_path_free);
-}
-
-/*
* et_mb_entity_view_refresh_current_level:
* @entity_view: EtMbEntityView
*
@@ -1343,7 +1212,11 @@ et_mb_entity_view_finalize (GObject *object)
g_return_if_fail (object != NULL);
g_return_if_fail (IS_ET_MB_ENTITY_VIEW(object));
- g_object_unref (priv->list_store);
+ if (priv->list_store)
+ {
+ g_object_unref (priv->list_store);
+ }
+
G_OBJECT_CLASS (et_mb_entity_view_parent_class)->finalize(object);
}
diff --git a/src/musicbrainz_dialog.c b/src/musicbrainz_dialog.c
index 003fc82..f5c5012 100644
--- a/src/musicbrainz_dialog.c
+++ b/src/musicbrainz_dialog.c
@@ -258,10 +258,6 @@ btn_manual_find_clicked (GtkWidget *btn, gpointer user_data);
static void
tool_btn_toggle_red_lines_clicked (GtkWidget *btn, gpointer user_data);
static void
-tool_btn_up_clicked (GtkWidget *btn, gpointer user_data);
-static void
-tool_btn_down_clicked (GtkWidget *btn, gpointer user_data);
-static void
tool_btn_invert_selection_clicked (GtkWidget *btn, gpointer user_data);
static void
tool_btn_select_all_clicked (GtkWidget *btn, gpointer user_data);
@@ -272,8 +268,6 @@ tool_btn_refresh_clicked (GtkWidget *btn, gpointer user_data);
static void
btn_manual_stop_clicked (GtkWidget *btn, gpointer user_data);
static void
-entry_tree_view_search_changed (GtkEditable *editable, gpointer user_data);
-static void
selected_find_callback (GObject *source, GAsyncResult *res,
gpointer user_data);
static void
@@ -782,40 +776,6 @@ tool_btn_toggle_red_lines_clicked (GtkWidget *btn, gpointer user_data)
* @btn: GtkButton
* @user_data: User data
*
- * Signal Handler for "clicked" signal of toolbtn_up.
- */
-static void
-tool_btn_up_clicked (GtkWidget *btn, gpointer user_data)
-{
- EtMusicBrainzDialogPrivate *mb_dialog_priv;
-
- mb_dialog_priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (ET_MUSICBRAINZ_DIALOG (mbDialog));
- et_mb_entity_view_select_up (ET_MB_ENTITY_VIEW (mb_dialog_priv->entityView));
-}
-
-/*
- * btn_manual_stop_clicked:
- * @btn: GtkButton
- * @user_data: User data
- *
- * Signal Handler for "clicked" signal of toolbtn_down.
- */
-static void
-tool_btn_down_clicked (GtkWidget *btn, gpointer user_data)
-{
- EtMusicBrainzDialogPrivate *mb_dialog_priv;
- EtMusicBrainzDialog *dlg;
-
- dlg = ET_MUSICBRAINZ_DIALOG (mbDialog);
- mb_dialog_priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (dlg);
- et_mb_entity_view_select_down (ET_MB_ENTITY_VIEW (mb_dialog_priv->entityView));
-}
-
-/*
- * btn_manual_stop_clicked:
- * @btn: GtkButton
- * @user_data: User data
- *
* Signal Handler for "clicked" signal of toolbtn_invert_selection.
*/
static void
@@ -935,26 +895,6 @@ btn_manual_stop_clicked (GtkWidget *btn, gpointer user_data)
}
/*
- * entry_tree_view_search_changed:
- * @editable: GtkEditable for which handler is called
- * @user_data: User data
- *
- * Signal Handler for "changed" signal of entry_tree_view_search.
- */
-static void
-entry_tree_view_search_changed (GtkEditable *editable, gpointer user_data)
-{
- EtMusicBrainzDialogPrivate *mb_dialog_priv;
- EtMusicBrainzDialog *dlg;
-
- dlg = ET_MUSICBRAINZ_DIALOG (mbDialog);
- mb_dialog_priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (dlg);
- et_mb_entity_view_search_in_results (ET_MB_ENTITY_VIEW (mb_dialog_priv->entityView),
- gtk_entry_get_text (GTK_ENTRY (gtk_builder_get_object (builder,
- "entry_tree_view_search"))));
-}
-
-/*
* selected_find_callback:
* @source: Source Object
* @res: GSimpleAsyncResult
@@ -2418,12 +2358,6 @@ et_music_brainz_dialog_toolbar_buttons_set_sensitive (gboolean sensitive)
return;
}
- gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "entry_tree_view_search")),
- sensitive);
- gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "toolbtn_up")),
- sensitive);
- gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "toolbtn_down")),
- sensitive);
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "toolbtn_invert_selection")),
sensitive);
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "toolbtn_select_all")),
@@ -2554,7 +2488,7 @@ et_musicbrainz_dialog_init (EtMusicBrainzDialog *dialog)
gtk_window_set_title (GTK_WINDOW (dialog), "MusicBrainz Search");
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
box, TRUE, TRUE, 2);
- gtk_widget_set_size_request (GTK_WIDGET (dialog), 700, 500);
+ gtk_widget_set_size_request (GTK_WIDGET (dialog), 600, 500);
/* Pack EtMbEntityView into central box */
gtk_box_pack_start (GTK_BOX (gtk_builder_get_object (builder, "central_box")),
priv->entityView, TRUE, TRUE, 2);
@@ -2567,12 +2501,6 @@ et_musicbrainz_dialog_init (EtMusicBrainzDialog *dialog)
g_signal_connect (gtk_builder_get_object (builder, "btn_manual_find"),
"clicked", G_CALLBACK (btn_manual_find_clicked),
NULL);
- g_signal_connect (gtk_builder_get_object (builder, "toolbtn_up"),
- "clicked", G_CALLBACK (tool_btn_up_clicked),
- NULL);
- g_signal_connect (gtk_builder_get_object (builder, "toolbtn_down"),
- "clicked", G_CALLBACK (tool_btn_down_clicked),
- NULL);
g_signal_connect (gtk_builder_get_object (builder, "toolbtn_select_all"),
"clicked", G_CALLBACK (tool_btn_select_all_clicked),
NULL);
@@ -2609,10 +2537,6 @@ et_musicbrainz_dialog_init (EtMusicBrainzDialog *dialog)
g_signal_connect (gtk_builder_get_object (builder, "btn_fetch_more"),
"clicked", G_CALLBACK (btn_fetch_more_clicked),
NULL);
- g_signal_connect_after (gtk_builder_get_object (builder, "entry_tree_view_search"),
- "changed",
- G_CALLBACK (entry_tree_view_search_changed),
- NULL);
/* Fill Values in cb_manual_search_in */
cb_manual_search_in = GTK_WIDGET (gtk_builder_get_object (builder,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]