nemiver r915 - in trunk: . src/uicommon



Author: dodji
Date: Sun Aug 24 10:46:05 2008
New Revision: 915
URL: http://svn.gnome.org/viewvc/nemiver?rev=915&view=rev

Log:
Style fixes


Modified:
   trunk/ChangeLog
   trunk/src/uicommon/nmv-ui-utils.cc
   trunk/src/uicommon/nmv-ui-utils.h

Modified: trunk/src/uicommon/nmv-ui-utils.cc
==============================================================================
--- trunk/src/uicommon/nmv-ui-utils.cc	(original)
+++ trunk/src/uicommon/nmv-ui-utils.cc	Sun Aug 24 10:46:05 2008
@@ -1,5 +1,6 @@
 /* -*- Mode: C++; indent-tabs-mode:nil; c-basic-offset:4; -*- */
 
+// Author: Dodji Seketeli
 /*
  *This file is part of the Nemiver Project.
  *
@@ -27,7 +28,7 @@
 #include "nmv-ui-utils.h"
 #include <glib/gi18n.h>
 
-using namespace nemiver::common ;
+using namespace nemiver::common;
 
 namespace nemiver {
 namespace ui_utils {
@@ -37,20 +38,16 @@
                                     int a_num_entries,
                                     Glib::RefPtr<Gtk::ActionGroup> &a_group)
 {
-    THROW_IF_FAIL (a_group) ;
+    THROW_IF_FAIL (a_group);
 
-    for (int i=0; i < a_num_entries ; ++i) {
-        Glib::RefPtr<Gtk::Action> action = a_tab[i].to_action () ;
-        if (a_tab[i].m_accel != "")
-        {
+    for (int i=0; i < a_num_entries; ++i) {
+        Glib::RefPtr<Gtk::Action> action = a_tab[i].to_action ();
+        if (a_tab[i].m_accel != "") {
             a_group->add (action,
-                    Gtk::AccelKey (a_tab[i].m_accel),
-                    a_tab[i].m_activate_slot) ;
-        }
-        else
-        {
-            a_group->add (action,
-                    a_tab[i].m_activate_slot) ;
+                          Gtk::AccelKey (a_tab[i].m_accel),
+                          a_tab[i].m_activate_slot);
+        } else {
+            a_group->add (action, a_tab[i].m_activate_slot);
         }
     }
 }
@@ -67,8 +64,10 @@
     explicit DontShowAgainMsgDialog (const Glib::ustring &a_message,
                                      bool a_propose_dont_ask_again = false,
                                      bool a_use_markup = false,
-                                     Gtk::MessageType a_type = Gtk::MESSAGE_INFO,
-                                     Gtk::ButtonsType a_buttons = Gtk::BUTTONS_OK,
+                                     Gtk::MessageType a_type
+                                                         = Gtk::MESSAGE_INFO,
+                                     Gtk::ButtonsType a_buttons
+                                                         = Gtk::BUTTONS_OK,
                                      bool a_modal = false) :
         Gtk::MessageDialog (a_message,
                             a_use_markup,
@@ -112,9 +111,9 @@
 display_info (const UString &a_message)
 {
     Gtk::MessageDialog dialog (a_message, false, Gtk::MESSAGE_INFO,
-                                               Gtk::BUTTONS_OK, true) ;
-    dialog.set_default_response (Gtk::RESPONSE_OK) ;
-    return dialog.run () ;
+                                               Gtk::BUTTONS_OK, true);
+    dialog.set_default_response (Gtk::RESPONSE_OK);
+    return dialog.run ();
 }
 
 int
@@ -122,9 +121,9 @@
 {
     Gtk::MessageDialog dialog (a_message, false,
                                Gtk::MESSAGE_WARNING,
-                               Gtk::BUTTONS_OK, true) ;
-    dialog.set_default_response (Gtk::RESPONSE_OK) ;
-    return dialog.run () ;
+                               Gtk::BUTTONS_OK, true);
+    dialog.set_default_response (Gtk::RESPONSE_OK);
+    return dialog.run ();
 }
 
 int
@@ -132,9 +131,9 @@
 {
     Gtk::MessageDialog dialog (a_message, false,
                                Gtk::MESSAGE_ERROR,
-                               Gtk::BUTTONS_OK, true) ;
-    dialog.set_default_response (Gtk::RESPONSE_OK) ;
-    return dialog.run () ;
+                               Gtk::BUTTONS_OK, true);
+    dialog.set_default_response (Gtk::RESPONSE_OK);
+    return dialog.run ();
 }
 
 int
@@ -167,13 +166,13 @@
     Gtk::MessageDialog dialog (a_message, false,
                                Gtk::MESSAGE_QUESTION,
                                Gtk::BUTTONS_NONE,
-                               true) ;
+                               true);
 
-    dialog.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL) ;
-    dialog.add_button (Gtk::Stock::NO, Gtk::RESPONSE_NO) ;
-    dialog.add_button (Gtk::Stock::YES, Gtk::RESPONSE_YES) ;
-    dialog.set_default_response (Gtk::RESPONSE_CANCEL) ;
-    return dialog.run () ;
+    dialog.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+    dialog.add_button (Gtk::Stock::NO, Gtk::RESPONSE_NO);
+    dialog.add_button (Gtk::Stock::YES, Gtk::RESPONSE_YES);
+    dialog.set_default_response (Gtk::RESPONSE_CANCEL);
+    return dialog.run ();
 }
 
 

Modified: trunk/src/uicommon/nmv-ui-utils.h
==============================================================================
--- trunk/src/uicommon/nmv-ui-utils.h	(original)
+++ trunk/src/uicommon/nmv-ui-utils.h	Sun Aug 24 10:46:05 2008
@@ -1,5 +1,7 @@
 /* -*- Mode: C++; indent-tabs-mode:nil; c-basic-offset:4; -*- */
 
+// Author: Dodji Seketeli
+
 /*
  *This file is part of the Nemiver Project.
  *
@@ -37,35 +39,35 @@
 #ifndef NEMIVER_CATCH
 #define NEMIVER_CATCH \
 } catch (Glib::Exception &e) { \
-    LOG_ERROR (std::string ("caught exception: '") + e.what () + "'") ; \
-    nemiver::ui_utils::display_error (e.what ()) ; \
+    LOG_ERROR (std::string ("caught exception: '") + e.what () + "'"); \
+    nemiver::ui_utils::display_error (e.what ()); \
 } catch (std::exception &e) { \
-    LOG_ERROR (std::string ("caught exception: '") + e.what () + "'") ; \
-    nemiver::ui_utils::display_error (e.what ()) ; \
+    LOG_ERROR (std::string ("caught exception: '") + e.what () + "'"); \
+    nemiver::ui_utils::display_error (e.what ()); \
 } catch (...) { \
-    LOG_ERROR ("caught unknown exception") ; \
-    nemiver::ui_utils::display_error ("An unknown error occured") ; \
+    LOG_ERROR ("caught unknown exception"); \
+    nemiver::ui_utils::display_error ("An unknown error occured"); \
 }
 #endif
 
 #ifndef NEMIVER_CATCH_AND_RETURN
 #define NEMIVER_CATCH_AND_RETURN(a_value) \
 } catch (Glib::Exception &e) { \
-    LOG_ERROR (std::string ("caught exception: '") + e.what () + "'") ; \
-    nemiver::ui_utils::display_error (e.what ()) ; \
-    return a_value ; \
+    LOG_ERROR (std::string ("caught exception: '") + e.what () + "'"); \
+    nemiver::ui_utils::display_error (e.what ()); \
+    return a_value; \
 } catch (std::exception &e) { \
-    LOG_ERROR (std::string ("caught exception: '") + e.what () + "'") ; \
-    nemiver::ui_utils::display_error (e.what ()) ; \
-    return a_value ; \
+    LOG_ERROR (std::string ("caught exception: '") + e.what () + "'"); \
+    nemiver::ui_utils::display_error (e.what ()); \
+    return a_value; \
 } catch (...) { \
-    LOG_ERROR ("Caught unknown exception") ; \
-    nemiver::ui_utils::display_error ("An unknown error occured") ; \
-    return a_value ; \
+    LOG_ERROR ("Caught unknown exception"); \
+    nemiver::ui_utils::display_error ("An unknown error occured"); \
+    return a_value; \
 }
 #endif
 
-using nemiver::common::UString ;
+using nemiver::common::UString;
 
 namespace nemiver {
 namespace ui_utils {
@@ -78,17 +80,17 @@
         TOGGLE
     };
 
-    common::UString m_name ;
-    Gtk::StockID m_stock_id ;
-    common::UString m_label ;
-    common::UString m_tooltip ;
+    common::UString m_name;
+    Gtk::StockID m_stock_id;
+    common::UString m_label;
+    common::UString m_tooltip;
     sigc::slot<void> m_activate_slot;
     Type m_type;
-    common::UString m_accel ;
+    common::UString m_accel;
 
     Glib::RefPtr<Gtk::Action> to_action () const
     {
-        Glib::RefPtr<Gtk::Action> result ;
+        Glib::RefPtr<Gtk::Action> result;
         switch (m_type) {
             case DEFAULT:
                 if (m_stock_id.get_string () != "") {
@@ -99,7 +101,7 @@
                     result =
                         Gtk::Action::create (m_name, m_label, m_tooltip);
                 }
-                break ;
+                break;
             case TOGGLE:
                 if (m_stock_id.get_string () != "") {
                     result =
@@ -107,14 +109,16 @@
                                                    m_label, m_tooltip);
                 } else {
                     result =
-                        Gtk::ToggleAction::create (m_name, m_label, m_tooltip);
+                        Gtk::ToggleAction::create (m_name,
+                                                   m_label,
+                                                   m_tooltip);
                 }
                 break;
 
             default:
-                THROW ("should never reach this point") ;
+                THROW ("should never reach this point");
         }
-        return result ;
+        return result;
     }
 
 };//end class ActionEntry
@@ -122,41 +126,41 @@
 NEMIVER_API void add_action_entries_to_action_group
                                 (const ActionEntry a_tab[],
                                  int a_num_entries,
-                                 Glib::RefPtr<Gtk::ActionGroup> &a_group) ;
+                                 Glib::RefPtr<Gtk::ActionGroup> &a_group);
 
-NEMIVER_API int display_info (const common::UString &a_message) ;
+NEMIVER_API int display_info (const common::UString &a_message);
 
-NEMIVER_API int display_warning (const common::UString &a_message) ;
+NEMIVER_API int display_warning (const common::UString &a_message);
 
-NEMIVER_API int display_error (const common::UString &a_message) ;
+NEMIVER_API int display_error (const common::UString &a_message);
 
 NEMIVER_API int ask_yes_no_question (const common::UString &a_message);
 
 NEMIVER_API int ask_yes_no_question (const common::UString &a_message,
                                      bool a_propose_dont_ask_question,
-                                     bool &a_dont_ask_this_again) ;
+                                     bool &a_dont_ask_this_again);
 
-NEMIVER_API int ask_yes_no_cancel_question (const common::UString &a_message) ;
+NEMIVER_API int ask_yes_no_cancel_question (const common::UString &a_message);
 
 template <class T>
 T*
 get_widget_from_glade (const Glib::RefPtr<Gnome::Glade::Xml> &a_glade,
                        const UString &a_widget_name)
 {
-    Gtk::Widget *widget = a_glade->get_widget (a_widget_name) ;
+    Gtk::Widget *widget = a_glade->get_widget (a_widget_name);
     if (!widget) {
         THROW ("couldn't find widget '"
                + a_widget_name
                + "' in glade file: " + a_glade->get_filename ().c_str ());
     }
-    T *result = dynamic_cast<T*> (widget) ;
+    T *result = dynamic_cast<T*> (widget);
     if (!result) {
         //TODO: we may leak widget here if it is a toplevel widget
         //like Gtk::Window. In this case, we should make sure to delete it
         //before bailing out.
-        THROW ("widget " + a_widget_name + " is not of the expected type") ;
+        THROW ("widget " + a_widget_name + " is not of the expected type");
     }
-    return result ;
+    return result;
 }
 
 template <class T>
@@ -166,19 +170,19 @@
                        const Glib::RefPtr<Gnome::Glade::Xml> &a_glade)
 {
     UString path_to_glade_file =
-                common::env::build_path_to_glade_file (a_glade_file_name) ;
-    a_glade = Gnome::Glade::Xml::create (path_to_glade_file) ;
+                common::env::build_path_to_glade_file (a_glade_file_name);
+    a_glade = Gnome::Glade::Xml::create (path_to_glade_file);
     if (!a_glade) {
-        THROW ("Could not create glade from file " + path_to_glade_file) ;
+        THROW ("Could not create glade from file " + path_to_glade_file);
     }
-    return get_widget_from_glade<T> (a_glade, a_widget_name) ;
+    return get_widget_from_glade<T> (a_glade, a_widget_name);
 }
 
 struct WidgetRef {
     void operator () (Gtk::Widget *a_widget)
     {
         if (a_widget) {
-            a_widget->reference () ;
+            a_widget->reference ();
         }
     }
 };//end struct WidgetRef
@@ -187,7 +191,7 @@
     void operator () (Gtk::Widget *a_widget)
     {
         if (a_widget) {
-            a_widget->unreference () ;
+            a_widget->unreference ();
         }
     }
 };//end struct WidgetUnref



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