[easytag/wip/musicbrainz-support-merge: 6/9] Toolbar buttons are disabled at the starting



commit 45107834aa8a48d35ec56dbd82f9a1fb874b268a
Author: Abhinav <abhijangda hotmail com>
Date:   Tue Aug 12 16:32:39 2014 +0530

    Toolbar buttons are disabled at the starting

 data/musicbrainz_dialog.ui |    8 +++
 src/mbentityview.c         |    4 ++
 src/musicbrainz_dialog.c   |  112 +++++++++++++++++++++++++++++++++++++------
 src/musicbrainz_dialog.h   |    2 +
 4 files changed, 110 insertions(+), 16 deletions(-)
---
diff --git a/data/musicbrainz_dialog.ui b/data/musicbrainz_dialog.ui
index 1763d0b..af1c3dd 100755
--- a/data/musicbrainz_dialog.ui
+++ b/data/musicbrainz_dialog.ui
@@ -215,6 +215,7 @@
                         <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>
@@ -229,6 +230,7 @@
                     <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>
@@ -245,6 +247,7 @@
                     <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>
@@ -271,6 +274,7 @@
                     <child>
                       <object class="GtkToolButton" id="toolbtn_invert_selection">
                         <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">Invert Selections</property>
@@ -287,6 +291,7 @@
                     <child>
                       <object class="GtkToolButton" id="toolbtn_select_all">
                         <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">Select All</property>
@@ -303,6 +308,7 @@
                     <child>
                       <object class="GtkToolButton" id="toolbtn_unselect_all">
                         <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">Unselect All</property>
@@ -319,6 +325,7 @@
                     <child>
                       <object class="GtkToggleToolButton" id="toolbtn_toggle_red_lines">
                         <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">Toggle Red Lines</property>
@@ -335,6 +342,7 @@
                     <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>
diff --git a/src/mbentityview.c b/src/mbentityview.c
index fc4b257..1226b41 100644
--- a/src/mbentityview.c
+++ b/src/mbentityview.c
@@ -650,6 +650,8 @@ search_in_levels_callback (GObject *source, GAsyncResult *res,
     {
         g_object_unref (res);
         g_slice_free (SearchInLevelThreadData, user_data);
+        et_music_brainz_dialog_toolbar_buttons_set_sensitive (TRUE);
+        et_music_brainz_dialog_stop_set_sensitive (FALSE);
         return;
     }
 
@@ -712,6 +714,7 @@ search_in_levels_callback (GObject *source, GAsyncResult *res,
 
     g_slice_free (SearchInLevelThreadData, thread_data);
     et_music_brainz_dialog_stop_set_sensitive (FALSE);
+    et_music_brainz_dialog_toolbar_buttons_set_sensitive (TRUE);
 
     if (et_music_brainz_get_exit_on_complete ())
     {
@@ -926,6 +929,7 @@ search_in_levels (EtMbEntityView *entity_view, GNode *child,
                                          search_in_levels_thread_func,
                                          0, mb5_search_cancellable);
     et_music_brainz_dialog_stop_set_sensitive (TRUE);
+    et_music_brainz_dialog_toolbar_buttons_set_sensitive (FALSE);
 }
 
 /*
diff --git a/src/musicbrainz_dialog.c b/src/musicbrainz_dialog.c
index 9c8f2ed..7b9e4b8 100755
--- a/src/musicbrainz_dialog.c
+++ b/src/musicbrainz_dialog.c
@@ -264,8 +264,7 @@ get_selected_iter_list (GtkTreeView *tree_view, GList **list);
 static void
 btn_selected_find_clicked (GtkWidget *widget, gpointer user_data);
 static void
-get_first_selected_file (ET_File  **et_file);
-
+get_first_selected_file (ET_File **et_file);
 #ifdef ENABLE_libdiscid
 static void
 discid_search_callback (GObject *source, GAsyncResult *res,
@@ -460,6 +459,21 @@ manual_search_callback (GObject *source, GAsyncResult *res,
         et_music_brainz_dialog_stop_set_sensitive (FALSE);
         free_mb_tree (&thread_data->node);
 
+        if (mbDialog)
+        {
+            dlg = ET_MUSICBRAINZ_DIALOG (mbDialog);
+            priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (dlg);
+
+            if (priv->search)
+            {
+                et_music_brainz_dialog_toolbar_buttons_set_sensitive (TRUE);
+            }
+            else
+            {
+                et_music_brainz_dialog_toolbar_buttons_set_sensitive (FALSE);
+            }
+        }
+
         return;
     }
 
@@ -477,6 +491,7 @@ manual_search_callback (GObject *source, GAsyncResult *res,
     gtk_combo_box_text_append_text (combo_box,
                                     gtk_combo_box_text_get_active_text (combo_box));
     et_music_brainz_dialog_stop_set_sensitive (FALSE);
+    et_music_brainz_dialog_toolbar_buttons_set_sensitive (TRUE);
     priv->search = ET_MB_SEARCH_TYPE_MANUAL;
     et_mb_set_search_manual (&priv->search, thread_data->text_to_search,
                              priv->mb_tree_root, thread_data->type);
@@ -608,6 +623,7 @@ btn_fetch_more_clicked (GtkWidget *btn, gpointer user_data)
                                              manual_search_thread_func, 0,
                                              mb5_search_cancellable);
         et_music_brainz_dialog_stop_set_sensitive (TRUE);
+        et_music_brainz_dialog_toolbar_buttons_set_sensitive (FALSE);
     }
     else if (mb_dialog_priv->search->type == ET_MB_SEARCH_TYPE_SELECTED)
     {
@@ -662,6 +678,7 @@ btn_fetch_more_clicked (GtkWidget *btn, gpointer user_data)
         gtk_statusbar_push (mb_dialog_priv->statusbar, 0,
                             _("Starting Selected Files Search"));
         et_music_brainz_dialog_stop_set_sensitive (TRUE);
+        et_music_brainz_dialog_toolbar_buttons_set_sensitive (FALSE);
     }
 }
 
@@ -710,6 +727,7 @@ btn_manual_find_clicked (GtkWidget *btn, gpointer user_data)
                                          manual_search_thread_func, 0,
                                          mb5_search_cancellable);
     et_music_brainz_dialog_stop_set_sensitive (TRUE);
+    et_music_brainz_dialog_toolbar_buttons_set_sensitive (FALSE);
 }
 
 /*
@@ -933,6 +951,21 @@ selected_find_callback (GObject *source, GAsyncResult *res,
         g_array_unref (thread_data->n_nodes);
         g_slice_free (SelectedFindThreadData, user_data);
 
+        if (mbDialog)
+        {
+            dlg = ET_MUSICBRAINZ_DIALOG (mbDialog);
+            mb_dialog_priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (dlg);
+
+            if (mb_dialog_priv->search)
+            {
+                et_music_brainz_dialog_toolbar_buttons_set_sensitive (TRUE);
+            }
+            else
+            {
+                et_music_brainz_dialog_toolbar_buttons_set_sensitive (FALSE);
+            }
+        }
+
         return;
     }
 
@@ -948,6 +981,7 @@ selected_find_callback (GObject *source, GAsyncResult *res,
     g_object_unref (res);
     g_hash_table_destroy (thread_data->hash_table);
     et_music_brainz_dialog_stop_set_sensitive (FALSE);
+    et_music_brainz_dialog_toolbar_buttons_set_sensitive (TRUE);
 
     if (mb_dialog_priv->exit_on_complete)
     {
@@ -1160,6 +1194,7 @@ btn_selected_find_clicked (GtkWidget *button, gpointer data)
     gtk_statusbar_push (mb_dialog_priv->statusbar, 0,
                         _("Starting Selected Files Search"));
     et_music_brainz_dialog_stop_set_sensitive (TRUE);
+    et_music_brainz_dialog_toolbar_buttons_set_sensitive (FALSE);
 }
 
 /*
@@ -1222,6 +1257,22 @@ discid_search_callback (GObject *source, GAsyncResult *res,
         g_object_unref (res);
         free_mb_tree (&thread_data->node);
         et_music_brainz_dialog_stop_set_sensitive (FALSE);
+
+        if (mbDialog)
+        {
+            dlg = ET_MUSICBRAINZ_DIALOG (mbDialog);
+            mb_dialog_priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (dlg);
+
+            if (mb_dialog_priv->search)
+            {
+                et_music_brainz_dialog_toolbar_buttons_set_sensitive (TRUE);
+            }
+            else
+            {
+                et_music_brainz_dialog_toolbar_buttons_set_sensitive (FALSE);
+            }
+        }
+
         return;
     }
 
@@ -1237,6 +1288,7 @@ discid_search_callback (GObject *source, GAsyncResult *res,
     g_object_unref (res);
     g_free (user_data);
     et_music_brainz_dialog_stop_set_sensitive (FALSE);
+    et_music_brainz_dialog_toolbar_buttons_set_sensitive (TRUE);
     gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "btn_fetch_more")),
                               FALSE);
 
@@ -1343,6 +1395,7 @@ btn_discid_search_clicked (GtkWidget *button, gpointer data)
                                          discid_search_thread_func, 0,
                                          mb5_search_cancellable);
     et_music_brainz_dialog_stop_set_sensitive (TRUE);
+    et_music_brainz_dialog_toolbar_buttons_set_sensitive (FALSE);
 #else
     GtkWidget *msg_dialog;
     
@@ -1392,6 +1445,22 @@ freedbid_search_callback (GObject *source, GAsyncResult *res,
         g_free (thread_data->cddb_discid);
         g_slice_free (FreeDBIDSearchThreadData, thread_data);
         et_music_brainz_dialog_stop_set_sensitive (FALSE);
+
+        if (mbDialog)
+        {
+            dlg = ET_MUSICBRAINZ_DIALOG (mbDialog);
+            mb_dialog_priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (dlg);
+
+            if (mb_dialog_priv->search)
+            {
+                et_music_brainz_dialog_toolbar_buttons_set_sensitive (TRUE);
+            }
+            else
+            {
+                et_music_brainz_dialog_toolbar_buttons_set_sensitive (FALSE);
+            }
+        }
+
         return;
     }
 
@@ -1408,6 +1477,7 @@ freedbid_search_callback (GObject *source, GAsyncResult *res,
     g_free (thread_data->cddb_discid);
     g_slice_free (FreeDBIDSearchThreadData, thread_data);
     et_music_brainz_dialog_stop_set_sensitive (FALSE);
+    et_music_brainz_dialog_toolbar_buttons_set_sensitive (TRUE);
     et_mb_set_automatic_search (&mb_dialog_priv->search);
 
     if (mb_dialog_priv->exit_on_complete)
@@ -1604,6 +1674,7 @@ btn_automatic_search_clicked (GtkWidget *btn, gpointer data)
                                          freedbid_search_thread_func, 0,
                                          mb5_search_cancellable);
     et_music_brainz_dialog_stop_set_sensitive (TRUE);
+    et_music_brainz_dialog_toolbar_buttons_set_sensitive (FALSE);
 }
 
 /*
@@ -2050,7 +2121,7 @@ et_music_brainz_dialog_stop_set_sensitive (gboolean sensitive)
 {
     EtMusicBrainzDialogPrivate *mb_dialog_priv;
 
-    if (!IS_ET_MUSICBRAINZ_DIALOG (mbDialog))
+    if (!mbDialog)
     {
         return;
     }
@@ -2058,8 +2129,8 @@ et_music_brainz_dialog_stop_set_sensitive (gboolean sensitive)
     mb_dialog_priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (ET_MUSICBRAINZ_DIALOG (mbDialog));
     gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "btn_stop")),
                               sensitive);
-    gtk_widget_set_sensitive (mb_dialog_priv->entityView, !sensitive);
-    gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "btn_manual_find")), TRUE);
+    gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "btn_apply_changes")),
+                              !sensitive);
     gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "btn_manual_find")),
                               !sensitive);
     gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "btn_selected_find")),
@@ -2068,26 +2139,35 @@ et_music_brainz_dialog_stop_set_sensitive (gboolean sensitive)
                               !sensitive);
     gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "btn_disc_find")),
                               !sensitive);
+    gtk_widget_set_sensitive (mb_dialog_priv->entityView, !sensitive);
+}
+
+void
+et_music_brainz_dialog_toolbar_buttons_set_sensitive (gboolean sensitive)
+{
+    if (!mbDialog)
+    {
+        return;
+    }
+
     gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "entry_tree_view_search")),
-                              !sensitive);
+                              sensitive);
     gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "toolbtn_up")),
-                              !sensitive);
+                              sensitive);
     gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "toolbtn_down")),
-                              !sensitive);
+                              sensitive);
     gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "toolbtn_invert_selection")),
-                              !sensitive);
+                              sensitive);
     gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "toolbtn_select_all")),
-                              !sensitive);
+                              sensitive);
     gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "toolbtn_unselect_all")),
-                              !sensitive);
+                              sensitive);
     gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "toolbtn_toggle_red_lines")),
-                              !sensitive);
+                              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_apply_changes")),
-                              !sensitive);
+                              sensitive);
     gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "btn_fetch_more")),
-                              !sensitive);
+                              sensitive);
 }
 
 /*
diff --git a/src/musicbrainz_dialog.h b/src/musicbrainz_dialog.h
index 5249e33..aff3d9f 100755
--- a/src/musicbrainz_dialog.h
+++ b/src/musicbrainz_dialog.h
@@ -97,6 +97,8 @@ void
 et_music_brainz_dialog_set_statusbar_message (gchar *message);
 void
 et_music_brainz_dialog_set_response (GtkResponseType response);
+void
+et_music_brainz_dialog_toolbar_buttons_set_sensitive (gboolean sensitive);
 G_END_DECLS
 #endif /* __MUSICBRAINZ_DIALOG_H__ */
 #endif /* ENABLE_libmusicbrainz */
\ No newline at end of file


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