[gtranslator: 2/4] Improve code styling in info-bar




commit 07ae44aa92ad3b2653853693d1dc4d0d821633ac
Author: Daniel GarcĂ­a Moreno <dani danigm net>
Date:   Mon May 30 20:35:32 2022 +0200

    Improve code styling in info-bar

 src/gtr-io-error-info-bar.c | 33 +++++++++++++++++++--------------
 src/gtr-io-error-info-bar.h |  8 ++++----
 src/gtr-tab.c               |  2 +-
 3 files changed, 24 insertions(+), 19 deletions(-)
---
diff --git a/src/gtr-io-error-info-bar.c b/src/gtr-io-error-info-bar.c
index 709e1219..ae2925d6 100644
--- a/src/gtr-io-error-info-bar.c
+++ b/src/gtr-io-error-info-bar.c
@@ -127,8 +127,9 @@ set_info_bar_text_and_icon (GtkInfoBar * infobar,
  * Callback func called when warning button is clicked
  */
 static void
-handle_info_bar_response(GtkWidget * infobar,gint response_id,
-                        GtrTab * tab)
+handle_info_bar_response (GtkWidget * infobar,
+                          gint response_id,
+                          GtrTab * tab)
 {
   if (response_id == GTK_RESPONSE_OK || response_id == GTK_RESPONSE_CLOSE)
   {
@@ -183,7 +184,7 @@ show_info_bar (GtrTab * tab)
 
   gtk_widget_show (infobar);
 
-  gtr_tab_set_info_bar(tab, infobar);
+  gtr_tab_set_info_bar (tab, infobar);
 }
 
 void
@@ -191,29 +192,33 @@ create_error_info_bar (const gchar * primary_text,
                        const gchar * secondary_text,
                        GtrTab * tab)
 {
-  message_struct msg_struct_temp = {g_strdup(primary_text), g_strdup(secondary_text), ERROR_MSG};
+  message_struct msg_struct_temp = {
+    g_strdup (primary_text),
+    g_strdup (secondary_text),
+    ERROR_MSG
+  };
 
   if (msg_queue_arr == NULL)
-    msg_queue_arr = g_array_new (FALSE, FALSE, sizeof(message_struct));
+    msg_queue_arr = g_array_new (FALSE, FALSE, sizeof (message_struct));
 
   g_array_append_val (msg_queue_arr, msg_struct_temp);
-
-  if (msg_queue_arr -> len == 1)
-    show_info_bar(tab);
+  show_info_bar (tab);
 }
 
 void
 create_info_info_bar (const gchar * primary_text,
                       const gchar * secondary_text,
-                      GtrTab * tab )
+                      GtrTab * tab)
 {
-  message_struct msg_struct_temp = {g_strdup(primary_text), g_strdup(secondary_text), INFO_MSG};
+  message_struct msg_struct_temp = {
+    g_strdup(primary_text),
+    g_strdup(secondary_text),
+    INFO_MSG
+  };
 
   if (msg_queue_arr == NULL)
-    msg_queue_arr = g_array_new (FALSE, FALSE, sizeof(message_struct));
+    msg_queue_arr = g_array_new (FALSE, FALSE, sizeof (message_struct));
 
   g_array_append_val (msg_queue_arr, msg_struct_temp);
-
-  if (msg_queue_arr->len == 1)
-    show_info_bar(tab);
+  show_info_bar (tab);
 }
diff --git a/src/gtr-io-error-info-bar.h b/src/gtr-io-error-info-bar.h
index 4b640333..0cb5b21d 100644
--- a/src/gtr-io-error-info-bar.h
+++ b/src/gtr-io-error-info-bar.h
@@ -26,12 +26,12 @@
 
 G_BEGIN_DECLS
   void create_error_info_bar (const gchar * primary_text,
-                                     const gchar * secondary_text,
-                                     GtrTab * tab);
+                              const gchar * secondary_text,
+                              GtrTab * tab);
 
   void create_info_info_bar (const gchar * primary_text,
-                                    const gchar * secondary_text,
-                                    GtrTab * tab);
+                             const gchar * secondary_text,
+                             GtrTab * tab);
 
 G_END_DECLS
 #endif
diff --git a/src/gtr-tab.c b/src/gtr-tab.c
index f4302eae..988d342a 100644
--- a/src/gtr-tab.c
+++ b/src/gtr-tab.c
@@ -354,7 +354,7 @@ gtr_tab_edition_finished (GtrTab * tab, GtrMsg * msg)
       gtr_tab_block_movement (tab);
 
       create_error_info_bar (_("There is an error in the message:"),
-                                       message_error, tab);
+                             message_error, tab);
       g_free (message_error);
     }
   else


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