[gnome-devel-docs] platform-demos, aboutdialog: follow GNOME C style



commit cf4ef5cf42e5a33009e5a25b764ed34b40dabc13
Author: Mohammed Sadik <sadiq sadiqpk org>
Date:   Wed Apr 6 15:36:00 2016 +0530

    platform-demos, aboutdialog: follow GNOME C style
    
    Separate functions by single line, no trailing white-spaces, always be
    consistent in indentation (2 spaces), and so on.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=764675

 platform-demos/C/samples/aboutdialog.c |   96 ++++++++++++++------------------
 1 files changed, 41 insertions(+), 55 deletions(-)
---
diff --git a/platform-demos/C/samples/aboutdialog.c b/platform-demos/C/samples/aboutdialog.c
index 656a4f0..cffb480 100644
--- a/platform-demos/C/samples/aboutdialog.c
+++ b/platform-demos/C/samples/aboutdialog.c
@@ -1,7 +1,5 @@
 #include <gtk/gtk.h>
 
-
-
 /* Callback function in which reacts to the "response" signal from the user in
  * the message dialog window.
  * This function is used to destroy the dialog window.
@@ -11,13 +9,10 @@ on_close (GtkDialog *dialog,
           gint       response_id,
           gpointer   user_data)
 {
-  /*This will cause the dialog to be destroyed*/
+  /* This will cause the dialog to be destroyed */
   gtk_widget_destroy (GTK_WIDGET (dialog));
-
 }
 
-
-
 /* Callback function for the response signal "activate" related to the SimpleAction
  * "about_action".
  * This function is used to cause the about dialog window to popup.
@@ -27,42 +22,40 @@ about_cb (GSimpleAction *simple,
           GVariant      *parameter,
           gpointer       user_data)
 {
-   GtkWidget *about_dialog;
-
-   about_dialog = gtk_about_dialog_new ();
-
-   /* Lists of authors/ documentators to be used later, they must be initialized
-    * in a null terminated array of strings.
-    */
-   const gchar *authors[] = {"GNOME Documentation Team", NULL};
-   const gchar *documenters[] = {"GNOME Documentation Team", NULL};
-
-   /* We fill in the information for the about dialog */
-   gtk_about_dialog_set_program_name (GTK_ABOUT_DIALOG (about_dialog), "AboutDialog Example");
-   gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG (about_dialog), "Copyright \xc2\xa9 2012 GNOME 
Documentation Team");
-   gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG (about_dialog), authors);
-   gtk_about_dialog_set_documenters (GTK_ABOUT_DIALOG (about_dialog), documenters);
-   gtk_about_dialog_set_website_label (GTK_ABOUT_DIALOG (about_dialog), "GNOME Developer Website");
-   gtk_about_dialog_set_website (GTK_ABOUT_DIALOG (about_dialog), "http://developer.gnome.org";);
-
-  /* We do not wish to show the title, which in this case would be 
-   * "AboutDialog Example". We have to reset the title of the messagedialog 
+  GtkWidget *about_dialog;
+
+  about_dialog = gtk_about_dialog_new ();
+
+  /* Lists of authors/ documentators to be used later, they must be initialized
+   * in a null terminated array of strings.
+   */
+  const gchar *authors[] = {"GNOME Documentation Team", NULL};
+  const gchar *documenters[] = {"GNOME Documentation Team", NULL};
+
+  /* We fill in the information for the about dialog */
+  gtk_about_dialog_set_program_name (GTK_ABOUT_DIALOG (about_dialog), "AboutDialog Example");
+  gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG (about_dialog), "Copyright \xc2\xa9 2012 GNOME 
Documentation Team");
+  gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG (about_dialog), authors);
+  gtk_about_dialog_set_documenters (GTK_ABOUT_DIALOG (about_dialog), documenters);
+  gtk_about_dialog_set_website_label (GTK_ABOUT_DIALOG (about_dialog), "GNOME Developer Website");
+  gtk_about_dialog_set_website (GTK_ABOUT_DIALOG (about_dialog), "http://developer.gnome.org";);
+
+  /* We do not wish to show the title, which in this case would be
+   * "AboutDialog Example". We have to reset the title of the messagedialog
    * window after setting the program name.
    */
   gtk_window_set_title (GTK_WINDOW (about_dialog), "");
 
-  /* To close the aboutdialog when "close" is clicked we connect the response 
+  /* To close the aboutdialog when "close" is clicked we connect the response
    * signal to on_close
    */
-  g_signal_connect (GTK_DIALOG (about_dialog), "response", 
+  g_signal_connect (GTK_DIALOG (about_dialog), "response",
                     G_CALLBACK (on_close), NULL);
 
   /* Show the about dialog */
-  gtk_widget_show (about_dialog); 
+  gtk_widget_show (about_dialog);
 }
 
-
-
 static void
 activate (GtkApplication *app,
           gpointer        user_data)
@@ -76,32 +69,30 @@ activate (GtkApplication *app,
   gtk_window_set_title (GTK_WINDOW (window), "AboutDialog Example");
   gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
 
-  /* Create a new simple action, giving it a NULL parameter type. It will 
-   * always be NULL for actions invoked from a menu. (e.g clicking on an "ok" 
+  /* Create a new simple action, giving it a NULL parameter type. It will
+   * always be NULL for actions invoked from a menu. (e.g clicking on an "ok"
    * or "cancel" button)
    */
-  about_action = g_simple_action_new ("about", NULL); 
+  about_action = g_simple_action_new ("about", NULL);
 
-  /* Connect the "activate" signal to the appropriate callback function. 
+  /* Connect the "activate" signal to the appropriate callback function.
    * It will indicate that the action was just activated.
    */
-  g_signal_connect (about_action, "activate", G_CALLBACK (about_cb), 
+  g_signal_connect (about_action, "activate", G_CALLBACK (about_cb),
                     GTK_WINDOW (window));
 
-  /* Adds the about_action to the overall action map. An Action map is an 
-   * interface that contains a number of named GAction instances 
-   * (such as about_action) 
+  /* Adds the about_action to the overall action map. An Action map is an
+   * interface that contains a number of named GAction instances
+   * (such as about_action)
    */
   g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (about_action));
 
   gtk_widget_show_all (window);
 }
 
-
-
-/* Callback function for the response signal "activate" from the "quit" action 
+/* Callback function for the response signal "activate" from the "quit" action
  * found in the function directly below.
- */ 
+ */
 static void
 quit_cb (GSimpleAction *simple,
          GVariant      *parameter,
@@ -112,8 +103,6 @@ quit_cb (GSimpleAction *simple,
   g_application_quit (application);
 }
 
-
-
 /* Startup function for the menu we are creating in this sample */
 static void
 startup (GApplication *app,
@@ -122,15 +111,15 @@ startup (GApplication *app,
   GMenu *menu;
   GSimpleAction *quit_action;
 
-  /* Initialize the GMenu, and add a menu item with label "About" and action 
-   * "win.about". Also add another menu item with label "Quit" and action 
-   * "app.quit" 
+  /* Initialize the GMenu, and add a menu item with label "About" and action
+   * "win.about". Also add another menu item with label "Quit" and action
+   * "app.quit"
    */
   menu = g_menu_new ();
   g_menu_append (menu, "About", "win.about");
   g_menu_append (menu, "Quit", "app.quit");
 
-  /* Create a new simple action for the application. (In this case it is the 
+  /* Create a new simple action for the application. (In this case it is the
    * "quit" action.
    */
   quit_action = g_simple_action_new ("quit", NULL);
@@ -138,17 +127,14 @@ startup (GApplication *app,
   /* Ensure that the menu we have just created is set for the overall application */
   gtk_application_set_app_menu (GTK_APPLICATION (app), G_MENU_MODEL (menu));
 
-  g_signal_connect (quit_action, 
-                    "activate", 
-                    G_CALLBACK (quit_cb), 
+  g_signal_connect (quit_action,
+                    "activate",
+                    G_CALLBACK (quit_cb),
                     app);
 
   g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (quit_action));
-
 }
 
-
-
 /* Startup function for the application */
 int
 main (int argc, char **argv)


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