[easytag/wip/application-window: 26/26] Move log area to EtLogArea object



commit 18a993dc985123f326482083c7b6cb4610b21c43
Author: David King <amigadave amigadave com>
Date:   Mon Nov 4 22:27:57 2013 +0000

    Move log area to EtLogArea object

 src/application_window.c |   14 +++-
 src/application_window.h |    1 +
 src/bar.c                |    3 +-
 src/easytag.c            |   52 +++++-----
 src/log.c                |  245 +++++++++++++++++++++++++--------------------
 src/log.h                |   44 ++++++---
 6 files changed, 210 insertions(+), 149 deletions(-)
---
diff --git a/src/application_window.c b/src/application_window.c
index ad3b1eb..727bab1 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -1704,7 +1704,7 @@ et_application_window_init (EtApplicationWindow *self)
 
 
     /* Log */
-    priv->log_area = Create_Log_Area ();
+    priv->log_area = et_log_area_new ();
     gtk_paned_pack2 (GTK_PANED (priv->vpaned), priv->log_area, FALSE, TRUE);
 
     /* Horizontal box for Status bar + Progress bar */
@@ -1814,6 +1814,18 @@ et_application_window_show_log_area (EtApplicationWindow *self)
     gtk_widget_hide (priv->log_area);
 }
 
+GtkWidget *
+et_application_window_get_log_area (EtApplicationWindow *self)
+{
+    EtApplicationWindowPrivate *priv;
+
+    g_return_val_if_fail (self != NULL, NULL);
+
+    priv = et_application_window_get_instance_private (self);
+
+    return priv->log_area;
+}
+
 /*
  * Disable (FALSE) / Enable (TRUE) all user widgets in the tag area
  */
diff --git a/src/application_window.h b/src/application_window.h
index 4957f57..2923203 100644
--- a/src/application_window.h
+++ b/src/application_window.h
@@ -51,6 +51,7 @@ void et_application_window_apply_changes (EtApplicationWindow *self);
 void et_application_window_tag_area_set_sensitive (EtApplicationWindow *self, gboolean sensitive);
 void et_application_window_file_area_set_sensitive (EtApplicationWindow *self, gboolean sensitive);
 void et_application_window_tag_area_display_controls (EtApplicationWindow *self, ET_File *ETFile);
+GtkWidget * et_application_window_get_log_area (EtApplicationWindow *self);
 void et_application_window_hide_log_area (EtApplicationWindow *self);
 void et_application_window_show_log_area (EtApplicationWindow *self);
 
diff --git a/src/bar.c b/src/bar.c
index d7c70c9..ab8ccd9 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -327,7 +327,8 @@ Create_UI (GtkWindow *window, GtkWidget **ppmenubar, GtkWidget **pptoolbar)
         //{ AM_ARTIST_OPEN_FILE_WITH,     GTK_STOCK_OPEN,    _("Open File(s) with…"),     NULL, _("Open 
File(s) with…"),     G_CALLBACK(Browser_Open_Run_Program_List_Window??? 
Browser_Open_Run_Program_Tree_Window???) },
         //{ AM_ALBUM_OPEN_FILE_WITH,      GTK_STOCK_OPEN,    _("Open File(s) with…"),     NULL, _("Open 
File(s) with…"),     G_CALLBACK(Browser_Open_Run_Program_List_Window??? 
Browser_Open_Run_Program_Tree_Window???) },
 
-        { AM_LOG_CLEAN,                 GTK_STOCK_CLEAR,   _("Clear log"),                 NULL, _("Clear 
log"),              G_CALLBACK(Log_Clean_Log_List) }
+        { AM_LOG_CLEAN, GTK_STOCK_CLEAR, _("Clear log"), NULL, _("Clear log"),
+         G_CALLBACK (et_log_area_clear) }
 
     };
 
diff --git a/src/easytag.c b/src/easytag.c
index 0fefb3e..7cba169 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -157,8 +157,34 @@ setup_sigchld (void)
 static void
 common_init (GApplication *application)
 {
+    gboolean settings_warning;
     EtApplicationWindow *window;
 
+    /* Create all config files. */
+    settings_warning = !Setting_Create_Files ();
+
+    /* Load Config */
+    Init_Config_Variables();
+    Read_Config();
+    /* Display_Config(); // <- for debugging */
+
+    /* Initialization */
+    ET_Core_Create();
+    Main_Stop_Button_Pressed = FALSE;
+    Init_Custom_Icons();
+    Init_Mouse_Cursor();
+    Init_OptionsWindow();
+    Init_ScannerWindow();
+    Init_CddbWindow();
+    BrowserEntryModel    = NULL;
+    TrackEntryComboModel = NULL;
+    GenreComboModel      = NULL;
+
+    /* The main window */
+    window = et_application_window_new ();
+    MainWindow = GTK_WIDGET (window);
+    et_application_set_window (ET_APPLICATION (application), window);
+
     /* Starting messages */
     Log_Print(LOG_OK,_("Starting EasyTAG version %s (PID: %d)…"),PACKAGE_VERSION,getpid());
 #ifdef ENABLE_MP3
@@ -181,35 +207,11 @@ common_init (GApplication *application)
                    _("Currently using locale '%s' (and eventually '%s')"),
                    get_locale (), get_encoding_from_locale (get_locale ()));
 
-
-    /* Create all config files. */
-    if (!Setting_Create_Files())
+    if (settings_warning)
     {
         Log_Print (LOG_WARNING, _("Unable to create setting directories"));
     }
 
-    /* Load Config */
-    Init_Config_Variables();
-    Read_Config();
-    /* Display_Config(); // <- for debugging */
-
-    /* Initialization */
-    ET_Core_Create();
-    Main_Stop_Button_Pressed = FALSE;
-    Init_Custom_Icons();
-    Init_Mouse_Cursor();
-    Init_OptionsWindow();
-    Init_ScannerWindow();
-    Init_CddbWindow();
-    BrowserEntryModel    = NULL;
-    TrackEntryComboModel = NULL;
-    GenreComboModel      = NULL;
-
-    /* The main window */
-    window = et_application_window_new ();
-    MainWindow = GTK_WIDGET (window);
-    et_application_set_window (ET_APPLICATION (application), window);
-
     /* Minimised window icon */
     gtk_widget_realize(MainWindow);
 
diff --git a/src/log.c b/src/log.c
index 577fb63..8af1ffd 100644
--- a/src/log.c
+++ b/src/log.c
@@ -30,6 +30,7 @@
 #include <unistd.h>
 
 #include "log.h"
+#include "application_window.h"
 #include "easytag.h"
 #include "bar.h"
 #include "setting.h"
@@ -37,16 +38,19 @@
 
 #include "win32/win32dep.h"
 
+/* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
+G_DEFINE_TYPE (EtLogArea, et_log_area, GTK_TYPE_FRAME)
 
-/****************
- * Declarations *
- ****************/
+#define et_log_area_get_instance_private(self) (self->priv)
 
-static GtkWidget *LogList = NULL;
-static GtkListStore *logListModel;
-/* Temporary list to store messages for the LogList when this control was not
- * yet created. */
-static GList *LogPrintTmpList = NULL;
+struct _EtLogAreaPrivate
+{
+    GtkWidget *log_view;
+    GtkListStore *log_model;
+    /* Temporary list to store messages for the LogList when this control was
+     * not yet created. */
+    GList *log_tmp_list;
+};
 
 enum
 {
@@ -58,17 +62,16 @@ enum
     LOG_COLUMN_COUNT
 };
 
-// File for log
+/* File for log. */
 static const gchar LOG_FILE[] = "easytag.log";
 
 // Structure used to store information for the temporary list
-typedef struct _Log_Data Log_Data;
-struct _Log_Data
+typedef struct
 {
-    gchar         *time;    /* The time of this line of log */
-    Log_Error_Type error_type;
-    gchar         *string;  /* The string of the line of log to display */
-};
+    gchar *time;    /* The time of this line of log */
+    EtLogAreaKind error_type;
+    gchar *string;  /* The string of the line of log to display */
+} EtLogAreaData;
 
 
 /**************
@@ -76,11 +79,10 @@ struct _Log_Data
  **************/
 static gboolean Log_Popup_Menu_Handler (GtkWidget *treeview,
                                         GdkEventButton *event, GtkMenu *menu);
-static void Log_List_Set_Row_Visible (GtkTreeModel *treeModel,
-                                      GtkTreeIter *rowIter);
-static void Log_Print_Tmp_List (void);
+static void Log_List_Set_Row_Visible (EtLogArea *self, GtkTreeIter *rowIter);
+static void Log_Print_Tmp_List (EtLogArea *self);
 static gchar *Log_Format_Date (void);
-static gchar *Log_Get_Stock_Id_From_Error_Type (Log_Error_Type error_type);
+static gchar *Log_Get_Stock_Id_From_Error_Type (EtLogAreaKind error_type);
 
 
 
@@ -88,17 +90,25 @@ static gchar *Log_Get_Stock_Id_From_Error_Type (Log_Error_Type error_type);
  * Functions *
  *************/
 
-GtkWidget *Create_Log_Area (void)
+static void
+et_log_area_class_init (EtLogAreaClass *klass)
+{
+    g_type_class_add_private (klass, sizeof (EtLogAreaPrivate));
+}
+
+static void
+et_log_area_init (EtLogArea *self)
 {
-    GtkWidget *Frame;
+    EtLogAreaPrivate *priv;
     GtkWidget *ScrollWindowLogList;
     GtkCellRenderer *renderer;
     GtkTreeViewColumn *column;
     GtkWidget *PopupMenu;
 
+    priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ET_TYPE_LOG_AREA,
+                                                     EtLogAreaPrivate);
 
-    Frame = gtk_frame_new(_("Log"));
-    gtk_container_set_border_width(GTK_CONTAINER(Frame), 2);
+    gtk_container_set_border_width (GTK_CONTAINER (self), 2);
 
     /*
      * The ScrollWindow and the List
@@ -106,27 +116,25 @@ GtkWidget *Create_Log_Area (void)
     ScrollWindowLogList = gtk_scrolled_window_new(NULL,NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ScrollWindowLogList),
                                    GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
-    gtk_container_add(GTK_CONTAINER(Frame),ScrollWindowLogList);
+    gtk_container_add (GTK_CONTAINER (self), ScrollWindowLogList);
 
     /* The file list */
-    logListModel = gtk_list_store_new(LOG_COLUMN_COUNT,
-                                      G_TYPE_STRING,
-                                      G_TYPE_STRING,
-                                      G_TYPE_STRING,
-                                      GDK_TYPE_COLOR,
-                                      GDK_TYPE_COLOR);
-
-    LogList = gtk_tree_view_new_with_model(GTK_TREE_MODEL(logListModel));
-    g_object_unref (logListModel);
-    gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(LogList), FALSE);
-    gtk_container_add(GTK_CONTAINER(ScrollWindowLogList), LogList);
-    gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(LogList), FALSE);
-    gtk_widget_set_size_request(LogList, 0, 0);
-    gtk_tree_view_set_reorderable(GTK_TREE_VIEW(LogList), FALSE);
-    gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(LogList)),GTK_SELECTION_MULTIPLE);
+    priv->log_model = gtk_list_store_new (LOG_COLUMN_COUNT, G_TYPE_STRING,
+                                          G_TYPE_STRING, G_TYPE_STRING,
+                                          GDK_TYPE_COLOR, GDK_TYPE_COLOR);
+
+    priv->log_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (priv->log_model));
+    g_object_unref (priv->log_model);
+    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->log_view), FALSE);
+    gtk_container_add (GTK_CONTAINER (ScrollWindowLogList), priv->log_view);
+    gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (priv->log_view), FALSE);
+    gtk_widget_set_size_request (priv->log_view, 0, 0);
+    gtk_tree_view_set_reorderable (GTK_TREE_VIEW (priv->log_view), FALSE);
+    gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->log_view)),
+                                 GTK_SELECTION_MULTIPLE);
 
     column = gtk_tree_view_column_new();
-    gtk_tree_view_append_column(GTK_TREE_VIEW(LogList), column);
+    gtk_tree_view_append_column (GTK_TREE_VIEW (priv->log_view), column);
     gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
 
     renderer = gtk_cell_renderer_pixbuf_new();
@@ -151,24 +159,28 @@ GtkWidget *Create_Log_Area (void)
                                         "foreground-gdk", LOG_ROW_FOREGROUND,
                                         NULL);
 
-    // Create Popup Menu on browser album list
+    /* Create Popup Menu on browser album list. */
     PopupMenu = gtk_ui_manager_get_widget(UIManager, "/LogPopup");
-    gtk_menu_attach_to_widget (GTK_MENU (PopupMenu), LogList, NULL);
-    g_signal_connect (G_OBJECT (LogList), "button-press-event",
+    gtk_menu_attach_to_widget (GTK_MENU (PopupMenu), priv->log_view, NULL);
+    g_signal_connect (priv->log_view, "button-press-event",
                       G_CALLBACK (Log_Popup_Menu_Handler), PopupMenu);
 
-    // Load pending messages in the Log list
-    Log_Print_Tmp_List();
+    /* Load pending messages in the Log list. */
+    Log_Print_Tmp_List (self);
 
     if (SHOW_LOG_VIEW)
-        //gtk_widget_show_all(ScrollWindowLogList);
-        gtk_widget_show_all(Frame);
-
-    //return ScrollWindowLogList;
-    return Frame;
+    {
+        gtk_widget_show_all (GTK_WIDGET (self));
+    }
 }
 
 
+GtkWidget *
+et_log_area_new ()
+{
+    return g_object_new (ET_TYPE_LOG_AREA, "label", _("Log"), NULL);
+}
+
 /*
  * Log_Popup_Menu_Handler : displays the corresponding menu
  */
@@ -189,8 +201,9 @@ Log_Popup_Menu_Handler (GtkWidget *treeview, GdkEventButton *event,
  * Set a row visible in the log list (by scrolling the list)
  */
 static void
-Log_List_Set_Row_Visible (GtkTreeModel *treeModel, GtkTreeIter *rowIter)
+Log_List_Set_Row_Visible (EtLogArea *self, GtkTreeIter *rowIter)
 {
+    EtLogAreaPrivate *priv;
     /*
      * TODO: Make this only scroll to the row if it is not visible
      * (like in easytag GTK1)
@@ -198,22 +211,33 @@ Log_List_Set_Row_Visible (GtkTreeModel *treeModel, GtkTreeIter *rowIter)
      */
     GtkTreePath *rowPath;
 
-    g_return_if_fail (treeModel != NULL);
+    priv = et_log_area_get_instance_private (self);
 
-    rowPath = gtk_tree_model_get_path(treeModel, rowIter);
-    gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(LogList), rowPath, NULL, FALSE, 0, 0);
-    gtk_tree_path_free(rowPath);
+    g_return_if_fail (priv->log_model != NULL);
+
+    rowPath = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->log_model),
+                                       rowIter);
+    gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (priv->log_view), rowPath,
+                                  NULL, FALSE, 0, 0);
+    gtk_tree_path_free (rowPath);
 }
 
 
 /*
  * Remove all lines in the log list
  */
-void Log_Clean_Log_List (void)
+void
+et_log_area_clear (void)
 {
-    if (logListModel)
+    EtApplicationWindow *window;
+    EtLogAreaPrivate *priv;
+
+    window = ET_APPLICATION_WINDOW (MainWindow);
+    priv = et_log_area_get_instance_private (ET_LOG_AREA (et_application_window_get_log_area (window)));
+
+    if (priv->log_model)
     {
-        gtk_list_store_clear(logListModel);
+        gtk_list_store_clear (priv->log_model);
     }
 }
 
@@ -238,11 +262,13 @@ Log_Format_Date (void)
 /*
  * Function to use anywhere in the application to send a message to the LogList
  */
-void Log_Print (Log_Error_Type error_type, gchar const *format, ...)
+void
+Log_Print (EtLogAreaKind error_type, const gchar const *format, ...)
 {
+    EtLogArea *self;
+    EtLogAreaPrivate *priv;
     va_list args;
     gchar *string;
-
     GtkTreeIter iter;
     static gboolean first_time = TRUE;
     static gchar *file_path = NULL;
@@ -250,44 +276,48 @@ void Log_Print (Log_Error_Type error_type, gchar const *format, ...)
     GFileOutputStream *file_ostream;
     GError *error = NULL;
 
+    self = ET_LOG_AREA (et_application_window_get_log_area (ET_APPLICATION_WINDOW (MainWindow)));
+    priv = et_log_area_get_instance_private (self);
+
     va_start (args, format);
-    string = g_strdup_vprintf(format, args);
+    string = g_strdup_vprintf (format, args);
     va_end (args);
 
     // If the log window is displayed then messages are displayed, else
     // the messages are stored in a temporary list.
-    if (LogList && logListModel)
+    if (priv->log_view && priv->log_model)
     {
         gint n_items;
         gchar *time = Log_Format_Date();
 
         /* Remove lines that exceed the limit. */
-        n_items = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (logListModel),
+        n_items = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->log_model),
                                                   NULL);
 
         if (n_items > LOG_MAX_LINES - 1
-        &&  gtk_tree_model_get_iter_first(GTK_TREE_MODEL(logListModel), &iter))
+            &&  gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->log_model),
+                                               &iter))
         {
-            gtk_list_store_remove(GTK_LIST_STORE(logListModel), &iter);
+            gtk_list_store_remove (GTK_LIST_STORE (priv->log_model), &iter);
         }
 
-        gtk_list_store_insert_with_values (logListModel, &iter, G_MAXINT,
+        gtk_list_store_insert_with_values (priv->log_model, &iter, G_MAXINT,
                                            LOG_PIXBUF,
                                            Log_Get_Stock_Id_From_Error_Type (error_type),
                                            LOG_TIME_TEXT, time, LOG_TEXT,
                                            string, LOG_ROW_BACKGROUND, NULL,
                                            LOG_ROW_FOREGROUND, NULL, -1);
-        Log_List_Set_Row_Visible(GTK_TREE_MODEL(logListModel), &iter);
-        g_free(time);
-    }else
+        Log_List_Set_Row_Visible (self, &iter);
+        g_free (time);
+    }
+    else
     {
-        Log_Data *LogData = g_malloc0(sizeof(Log_Data));
-        LogData->time       = Log_Format_Date();
-        LogData->error_type = error_type;
-        LogData->string     = g_strdup(string);
+        EtLogAreaData *log_data = g_malloc0 (sizeof (EtLogAreaData));
+        log_data->time = Log_Format_Date ();
+        log_data->error_type = error_type;
+        log_data->string = g_strdup (string);
 
-        LogPrintTmpList = g_list_append(LogPrintTmpList,LogData);
-        //g_print("%s",string);
+        priv->log_tmp_list = g_list_append (priv->log_tmp_list, log_data);
     }
 
     // Store also the messages in the log file.
@@ -384,76 +414,73 @@ void Log_Print (Log_Error_Type error_type, gchar const *format, ...)
  * Display pending messages in the LogList
  */
 static void
-Log_Print_Tmp_List (void)
+Log_Print_Tmp_List (EtLogArea *self)
 {
+    EtLogAreaPrivate *priv;
     GList *l;
     GtkTreeIter iter;
 
-    LogPrintTmpList = g_list_first (LogPrintTmpList);
-    for (l = LogPrintTmpList; l != NULL; l = g_list_next (l))
+    priv = et_log_area_get_instance_private (self);
+
+    priv->log_tmp_list = g_list_first (priv->log_tmp_list);
+
+    for (l = priv->log_tmp_list; l != NULL; l = g_list_next (l))
     {
-        if (LogList && logListModel)
+        if (priv->log_model && priv->log_view)
         {
-            gtk_list_store_insert_with_values (logListModel, &iter, G_MAXINT,
-                                               LOG_PIXBUF,
-                                               Log_Get_Stock_Id_From_Error_Type (((Log_Data 
*)l->data)->error_type),
-                                               LOG_TIME_TEXT,
-                                               ((Log_Data *)l->data)->time,
-                                               LOG_TEXT,
-                                               ((Log_Data *)l->data)->string,
+            EtLogAreaData *log_data = (EtLogAreaData *)l->data;
+            gtk_list_store_insert_with_values (priv->log_model, &iter,
+                                               G_MAXINT, LOG_PIXBUF,
+                                               Log_Get_Stock_Id_From_Error_Type (log_data->error_type),
+                                               LOG_TIME_TEXT, log_data->time,
+                                               LOG_TEXT, log_data->string,
                                                LOG_ROW_BACKGROUND, NULL,
                                                LOG_ROW_FOREGROUND, NULL, -1);
-            Log_List_Set_Row_Visible(GTK_TREE_MODEL(logListModel), &iter);
+            Log_List_Set_Row_Visible (self, &iter);
         }
     }
 
-    // Free the list...
-    if (LogPrintTmpList)
+    /* Free the list. */
+    if (priv->log_tmp_list)
     {
         GList *l;
 
-        for (l = LogPrintTmpList; l != NULL; l = g_list_next (l))
+        for (l = priv->log_tmp_list; l != NULL; l = g_list_next (l))
         {
-            g_free (((Log_Data *)l->data)->string);
-            g_free (((Log_Data *)l->data)->time);
-            g_free (((Log_Data *)l->data));
+            EtLogAreaData *log_data = (EtLogAreaData *)l->data;
+
+            g_free (log_data->string);
+            g_free (log_data->time);
+            g_free (log_data);
         }
 
-        g_list_free (LogPrintTmpList);
-        LogPrintTmpList = NULL;
+        g_list_free (priv->log_tmp_list);
+        priv->log_tmp_list = NULL;
     }
 }
 
 
 static gchar *
-Log_Get_Stock_Id_From_Error_Type (Log_Error_Type error_type)
+Log_Get_Stock_Id_From_Error_Type (EtLogAreaKind error_type)
 {
-    gchar *stock_id;
-
     switch (error_type)
     {
         case LOG_OK:
-            stock_id = GTK_STOCK_OK;
+            return GTK_STOCK_OK;
             break;
-
         case LOG_INFO:
-            stock_id = GTK_STOCK_DIALOG_INFO;
+            return GTK_STOCK_DIALOG_INFO;
             break;
-
         case LOG_WARNING:
-            stock_id = GTK_STOCK_DIALOG_WARNING;
+            return GTK_STOCK_DIALOG_WARNING;
             break;
-
         case LOG_ERROR:
-            stock_id = GTK_STOCK_DIALOG_ERROR;
+            return GTK_STOCK_DIALOG_ERROR;
             break;
-
         case LOG_UNKNOWN:
-            stock_id = NULL;
+            return NULL;
             break;
         default:
             g_assert_not_reached ();
     }
-
-    return stock_id;
 }
diff --git a/src/log.h b/src/log.h
index 6aea0be..fdf8db8 100644
--- a/src/log.h
+++ b/src/log.h
@@ -18,38 +18,56 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-
-#ifndef __LOG_H__
-#define __LOG_H__
+#ifndef ET_LOG_AREA_H_
+#define ET_LOG_AREA_H_
 
 #include <gtk/gtk.h>
 
-//#include "et_core.h"
+G_BEGIN_DECLS
+
+#define ET_TYPE_LOG_AREA (et_log_area_get_type ())
+#define ET_LOG_AREA(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), ET_TYPE_LOG_AREA, EtLogArea))
+
+typedef struct _EtLogArea EtLogArea;
+typedef struct _EtLogAreaClass EtLogAreaClass;
+typedef struct _EtLogAreaPrivate EtLogAreaPrivate;
 
+struct _EtLogArea
+{
+    /*< private >*/
+    GtkFrame parent_instance;
+    EtLogAreaPrivate *priv;
+};
+
+struct _EtLogAreaClass
+{
+    /*< private >*/
+    GtkFrameClass parent_class;
+};
 
 /*
  * Types of errors
  */
 typedef enum
 {                  
-    LOG_UNKNOWN = 0,
+    LOG_UNKNOWN,
     LOG_OK,
     LOG_INFO,
     LOG_WARNING,
     LOG_ERROR
-} Log_Error_Type;
+} EtLogAreaKind;
 
 
 /**************
  * Prototypes *
  **************/
 
-GtkWidget *Create_Log_Area      (void);
-
-void       Log_Clean_Log_List   (void);
-
-void Log_Print (Log_Error_Type error_type,
-                gchar const *format, ...) G_GNUC_PRINTF (2, 3);
+GType et_log_area_get_type (void);
+GtkWidget * et_log_area_new (void);
+void et_log_area_clear (void);
+void Log_Print (EtLogAreaKind error_type,
+                const gchar const *format, ...) G_GNUC_PRINTF (2, 3);
 
+G_END_DECLS
 
-#endif /* __LOG_H__ */
+#endif /* ET_LOG_AREA_H_ */


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