[easytag/wip/musicbrainz-support-merge: 54/55] Remove Refresh Operation



commit e1a718372b606280efd6d6920f4e6800fac8c079
Author: Abhinav <abhijangda hotmail com>
Date:   Fri Aug 15 22:32:39 2014 +0530

    Remove Refresh Operation

 data/musicbrainz_dialog.ui |   17 ------------
 src/mbentityview.c         |   37 +++-----------------------
 src/mbentityview.h         |    2 -
 src/musicbrainz_dialog.c   |   62 +-------------------------------------------
 4 files changed, 5 insertions(+), 113 deletions(-)
---
diff --git a/data/musicbrainz_dialog.ui b/data/musicbrainz_dialog.ui
index 1a4160e..bc7f71e 100755
--- a/data/musicbrainz_dialog.ui
+++ b/data/musicbrainz_dialog.ui
@@ -255,23 +255,6 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkToolButton" id="toolbtn_refresh">
-                    <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">Refresh</property>
-                    <property name="tooltip_text" translatable="yes">Refresh</property>
-                    <property name="label" translatable="yes">toolbutton9</property>
-                    <property name="use_underline">True</property>
-                    <property name="stock_id">gtk-refresh</property>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="homogeneous">True</property>
-                  </packing>
-                </child>
-                <child>
                   <object class="GtkToolButton" id="btn_stop">
                     <property name="visible">True</property>
                     <property name="sensitive">False</property>
diff --git a/src/mbentityview.c b/src/mbentityview.c
index a99913f..9358170 100644
--- a/src/mbentityview.c
+++ b/src/mbentityview.c
@@ -108,7 +108,7 @@ static void
 et_mb_entity_view_finalize (GObject *object);
 static void
 search_in_levels (EtMbEntityView *entity_view, GNode *child,
-                  GtkTreeIter *iter, gboolean is_refresh);
+                  GtkTreeIter *iter, gboolean is_fetch_more);
 
 /*************
  * Functions *
@@ -653,7 +653,7 @@ search_in_levels_callback (GObject *source, GAsyncResult *res,
     {
         GtkWidget *prev_active_toggle_btn;
 
-        /* Only run if iter is valid i.e. it is not a Refresh Operation */
+        /* Only run if iter is valid i.e. it is not a Fetch More Operation */
         children = gtk_container_get_children (GTK_CONTAINER (priv->bread_crumb_box));
         active_child = g_list_find (children, priv->active_toggle_button);
     
@@ -877,7 +877,7 @@ tree_view_row_activated (GtkTreeView *tree_view, GtkTreePath *path,
  */
 static void
 search_in_levels (EtMbEntityView *entity_view, GNode *child,
-                  GtkTreeIter *filter_iter, gboolean is_refresh)
+                  GtkTreeIter *filter_iter, gboolean is_fetch_more)
 {
     SearchInLevelThreadData *thread_data;
     EtMbEntityViewPrivate *priv;
@@ -901,7 +901,7 @@ search_in_levels (EtMbEntityView *entity_view, GNode *child,
                                                           filter_iter);
     }
 
-    if (!is_refresh && ((EtMbEntity *)child->data)->is_red_line)
+    if (!is_fetch_more && ((EtMbEntity *)child->data)->is_red_line)
     {
         /* If node is a red line and it is not a refresh operation */
         search_in_levels_callback (NULL, NULL, thread_data);
@@ -1152,35 +1152,6 @@ et_mb_entity_view_get_current_level (EtMbEntityView *entity_view)
 }
 
 /*
- * et_mb_entity_view_refresh_current_level:
- * @entity_view: EtMbEntityView
- *
- * To re download data from MusicBrainz Server at the current level.
- */
-void
-et_mb_entity_view_refresh_current_level (EtMbEntityView *entity_view)
-{
-    EtMbEntityViewPrivate *priv;
-    GNode *child;
-
-    priv = ET_MB_ENTITY_VIEW_GET_PRIVATE (entity_view);
-
-    /* Delete Current Data */
-    et_mb_entity_view_clear_all (entity_view);
-    child = g_node_first_child (priv->mb_tree_current_node);
-
-    while (child)
-    {
-        GNode *child1;
-        child1 = g_node_next_sibling (child);
-        free_mb_tree (&child);
-        child = child1;
-    }
-
-    search_in_levels (entity_view, priv->mb_tree_current_node, NULL, TRUE);
-}
-
-/*
  * et_mb_entity_view_clear_all:
  * @entity_view: EtMbEntityView
  *
diff --git a/src/mbentityview.h b/src/mbentityview.h
index c16ed46..be143de 100755
--- a/src/mbentityview.h
+++ b/src/mbentityview.h
@@ -172,8 +172,6 @@ void
 et_mb_entity_view_search_in_results (EtMbEntityView *entity_view,
                                      const gchar *text);
 void
-et_mb_entity_view_refresh_current_level (EtMbEntityView *entity_view);
-void
 et_mb_entity_view_select_up (EtMbEntityView *entity_view);
 void
 et_mb_entity_view_select_down (EtMbEntityView *entity_view);
diff --git a/src/musicbrainz_dialog.c b/src/musicbrainz_dialog.c
index aeb0088..22ecd31 100755
--- a/src/musicbrainz_dialog.c
+++ b/src/musicbrainz_dialog.c
@@ -264,8 +264,6 @@ tool_btn_select_all_clicked (GtkWidget *btn, gpointer user_data);
 static void
 tool_btn_unselect_all_clicked (GtkWidget *btn, gpointer user_data);
 static void
-tool_btn_refresh_clicked (GtkWidget *btn, gpointer user_data);
-static void
 btn_manual_stop_clicked (GtkWidget *btn, gpointer user_data);
 static void
 selected_find_callback (GObject *source, GAsyncResult *res,
@@ -604,7 +602,7 @@ btn_fetch_more_clicked (GtkWidget *btn, gpointer user_data)
     level = et_mb_entity_view_get_current_level (ET_MB_ENTITY_VIEW (mb_dialog_priv->entityView));
 
     if (mb_dialog_priv->search->type == ET_MB_SEARCH_TYPE_AUTOMATIC && 
-        level <= 2)
+        level >= 2)
     {
         /* if current search is automatic search and its level is 
          * greater than 1 then fetch more results for these albums */
@@ -828,59 +826,6 @@ tool_btn_unselect_all_clicked (GtkWidget *btn, gpointer user_data)
  * Signal Handler for "clicked" signal of btnManualStop.
  */
 static void
-tool_btn_refresh_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);
-
-    if (!mb_dialog_priv->search)
-    {
-        return;
-    }
-
-    if (et_mb_entity_view_get_current_level (ET_MB_ENTITY_VIEW (mb_dialog_priv->entityView)) >
-        1)
-    {
-        /* Current level is more than 1, refereshing means downloading an */
-        /* entity's children */
-        et_mb_entity_view_refresh_current_level (ET_MB_ENTITY_VIEW (mb_dialog_priv->entityView));
-        return;
-    }
-
-    if (mb_dialog_priv->search->type == ET_MB_SEARCH_TYPE_MANUAL)
-    {
-        EtMbManualSearch *manual_search;
-        GtkWidget *entry;
-
-        manual_search = (EtMbManualSearch *)mb_dialog_priv->search;
-        mb_dialog_priv->mb_tree_root = g_node_new (NULL);
-        entry = gtk_bin_get_child (GTK_BIN (gtk_builder_get_object (builder, "cb_manual_search")));
-        gtk_entry_set_text (GTK_ENTRY (entry), manual_search->to_search);
-        gtk_combo_box_set_active (GTK_COMBO_BOX (gtk_builder_get_object (builder, "cb_manual_search_in")),
-                                  manual_search->to_search_type);
-        btn_manual_find_clicked (NULL, NULL);
-    }
-    else if (mb_dialog_priv->search->type == ET_MB_SEARCH_TYPE_SELECTED)
-    {
-        btn_selected_find_clicked (NULL, NULL);
-    }
-    else if (mb_dialog_priv->search->type == ET_MB_SEARCH_TYPE_AUTOMATIC)
-    {
-        btn_automatic_search_clicked (NULL, NULL);
-    }
-}
-
-/*
- * btn_manual_stop_clicked:
- * @btn: GtkButton
- * @user_data: User data
- *
- * Signal Handler for "clicked" signal of btnManualStop.
- */
-static void
 btn_manual_stop_clicked (GtkWidget *btn, gpointer user_data)
 {
     if (G_IS_CANCELLABLE (mb5_search_cancellable))
@@ -2342,8 +2287,6 @@ et_music_brainz_dialog_toolbar_buttons_set_sensitive (gboolean sensitive)
                               sensitive);
     gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "toolbtn_toggle_red_lines")),
                               sensitive);
-    gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "toolbtn_refresh")),
-                              sensitive);
     gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "btn_fetch_more")),
                               sensitive);
     gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "btn_apply_changes")),
@@ -2489,9 +2432,6 @@ et_musicbrainz_dialog_init (EtMusicBrainzDialog *dialog)
     g_signal_connect (gtk_builder_get_object (builder, "toolbtn_toggle_red_lines"),
                       "clicked", G_CALLBACK (tool_btn_toggle_red_lines_clicked),
                       NULL);
-    g_signal_connect (gtk_builder_get_object (builder, "toolbtn_refresh"),
-                      "clicked", G_CALLBACK (tool_btn_refresh_clicked),
-                      NULL);
     g_signal_connect (gtk_builder_get_object (builder, "btn_selected_find"),
                       "clicked", G_CALLBACK (btn_selected_find_clicked),
                       NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]