[easytag/wip/gtkbuilder: 1/2] Move log area to GtkBuilder
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/gtkbuilder: 1/2] Move log area to GtkBuilder
- Date: Fri, 19 Sep 2014 22:48:12 +0000 (UTC)
commit 622be638168d22818028641df72032601f67edd3
Author: David King <amigadave amigadave com>
Date: Fri Sep 19 17:37:44 2014 +0100
Move log area to GtkBuilder
data/log_area.ui | 63 +++++++++++++++++++++
data/org.gnome.EasyTAG.gresource.xml | 1 +
po/POTFILES.in | 1 +
src/log.c | 99 ++++++++++++----------------------
src/log.h | 33 ++++++------
5 files changed, 115 insertions(+), 82 deletions(-)
---
diff --git a/data/log_area.ui b/data/log_area.ui
new file mode 100644
index 0000000..8921b4f
--- /dev/null
+++ b/data/log_area.ui
@@ -0,0 +1,63 @@
+<interface domain="easytag">
+ <requires lib="gtk+" version="3.4"/>
+ <object class="GtkListStore" id="log_model">
+ <columns>
+ <column type="gchararray"/>
+ <column type="gchararray"/>
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkGrid" id="log_grid">
+ <property name="orientation">vertical</property>
+ <property name="row-spacing">6</property>
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="log_label">
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Log</property>
+ <property name="visible">True</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="log_scrolled">
+ <property name="expand">True</property>
+ <property name="margin-left">12</property>
+ <property name="shadow-type">etched-in</property>
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkTreeView" id="log_view">
+ <property name="model">log_model</property>
+ <property name="headers-visible">False</property>
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkTreeViewColumn" id="log_icon_column">
+ <property name="sizing">autosize</property>
+ <child>
+ <object class="GtkCellRendererPixbuf" id="log_icon_renderer"/>
+ <attributes>
+ <attribute name="icon-name">0</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="log_time_renderer"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="log_text_renderer"/>
+ <attributes>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/data/org.gnome.EasyTAG.gresource.xml b/data/org.gnome.EasyTAG.gresource.xml
index 1fad756..b49f6fd 100644
--- a/data/org.gnome.EasyTAG.gresource.xml
+++ b/data/org.gnome.EasyTAG.gresource.xml
@@ -4,6 +4,7 @@
<file preprocess='xml-stripblanks'>browser.ui</file>
<file preprocess='xml-stripblanks'>cddb_dialog.ui</file>
<file preprocess='xml-stripblanks'>file_area.ui</file>
+ <file preprocess='xml-stripblanks'>log_area.ui</file>
<file preprocess='xml-stripblanks'>load_files_dialog.ui</file>
<file preprocess='xml-stripblanks'>menus.ui</file>
<file preprocess='xml-stripblanks'>playlist_dialog.ui</file>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d4589f2..ba1f9ac 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -3,6 +3,7 @@ data/easytag.desktop.in
[type: gettext/glade]data/browser.ui
[type: gettext/glade]data/cddb_dialog.ui
[type: gettext/glade]data/file_area.ui
+[type: gettext/glade]data/log_area.ui
[type: gettext/glade]data/load_files_dialog.ui
[type: gettext/glade]data/menus.ui
[type: gettext/glade]data/playlist_dialog.ui
diff --git a/src/log.c b/src/log.c
index 8aa6625..4df46e9 100644
--- a/src/log.c
+++ b/src/log.c
@@ -1,21 +1,20 @@
-/* log.c - 2007/03/25 */
-/*
- * EasyTAG - Tag editor for MP3 and Ogg Vorbis files
- * Copyright (C) 2000-2007 Jerome Couderc <easytag gmail com>
+/* EasyTAG - Tag editor for audio files
+ * Copyright (C) 2014 David King <amigadave amigadave com>
+ * Copyright (C) 2000-2007 Jerome Couderc <easytag gmail com>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <config.h>
@@ -38,7 +37,7 @@
#include "win32/win32dep.h"
/* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
-G_DEFINE_TYPE (EtLogArea, et_log_area, GTK_TYPE_FRAME)
+G_DEFINE_TYPE (EtLogArea, et_log_area, GTK_TYPE_BIN)
#define et_log_area_get_instance_private(self) (self->priv)
@@ -151,9 +150,7 @@ static void
et_log_area_init (EtLogArea *self)
{
EtLogAreaPrivate *priv;
- GtkWidget *ScrollWindowLogList;
- GtkCellRenderer *renderer;
- GtkTreeViewColumn *column;
+ GtkWidget *grid;
GtkBuilder *builder;
GError *error = NULL;
GMenuModel *menu_model;
@@ -163,51 +160,25 @@ et_log_area_init (EtLogArea *self)
gtk_container_set_border_width (GTK_CONTAINER (self), 2);
- /*
- * The ScrollWindow and the List
- */
- 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 (self), ScrollWindowLogList);
-
- /* The file list */
- priv->log_model = gtk_list_store_new (LOG_COLUMN_COUNT, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_STRING);
-
- 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_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 (priv->log_view), column);
- gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-
- renderer = gtk_cell_renderer_pixbuf_new();
- gtk_tree_view_column_pack_start(column, renderer, FALSE);
- gtk_tree_view_column_set_attributes (column, renderer,
- "icon-name", LOG_ICON_NAME,
- NULL);
-
- renderer = gtk_cell_renderer_text_new();
- gtk_tree_view_column_pack_start(column, renderer, FALSE);
- gtk_tree_view_column_set_attributes(column, renderer,
- "text", LOG_TIME_TEXT,
- NULL);
-
- renderer = gtk_cell_renderer_text_new();
- gtk_tree_view_column_pack_start(column, renderer, FALSE);
- gtk_tree_view_column_set_attributes(column, renderer,
- "text", LOG_TEXT,
- NULL);
+ builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (builder, "/org/gnome/EasyTAG/log_area.ui",
+ &error);
+
+ if (error != NULL)
+ {
+ g_error ("Unable to get log area from resource: %s",
+ error->message);
+ }
+
+ grid = GTK_WIDGET (gtk_builder_get_object (builder, "log_grid"));
+ gtk_container_add (GTK_CONTAINER (self), grid);
+
+ /* The list. */
+ priv->log_model = GTK_LIST_STORE (gtk_builder_get_object (builder,
+ "log_model"));
+ priv->log_view = GTK_WIDGET (gtk_builder_get_object (builder, "log_view"));
/* Create popup menu. */
- builder = gtk_builder_new ();
gtk_builder_add_from_resource (builder, "/org/gnome/EasyTAG/menus.ui",
&error);
@@ -231,8 +202,6 @@ et_log_area_init (EtLogArea *self)
/* Load pending messages in the Log list. */
Log_Print_Tmp_List (self);
- gtk_widget_show_all (GTK_WIDGET (self));
-
g_settings_bind (MainSettings, "log-show", self, "visible",
G_SETTINGS_BIND_DEFAULT);
}
@@ -241,7 +210,7 @@ et_log_area_init (EtLogArea *self)
GtkWidget *
et_log_area_new ()
{
- return g_object_new (ET_TYPE_LOG_AREA, "label", _("Log"), NULL);
+ return g_object_new (ET_TYPE_LOG_AREA, NULL);
}
/*
diff --git a/src/log.h b/src/log.h
index f744de4..871316d 100644
--- a/src/log.h
+++ b/src/log.h
@@ -1,21 +1,20 @@
-/* log.h - 2007/03/25 */
-/*
- * EasyTAG - Tag editor for MP3 and Ogg Vorbis files
- * Copyright (C) 2000-2007 Jerome Couderc <easytag gmail com>
+/* EasyTAG - Tag editor for audio files
+ * Copyright (C) 2014 David King <amigadave amigadave com>
+ * Copyright (C) 2000-2007 Jerome Couderc <easytag gmail com>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef ET_LOG_AREA_H_
@@ -35,14 +34,14 @@ typedef struct _EtLogAreaPrivate EtLogAreaPrivate;
struct _EtLogArea
{
/*< private >*/
- GtkFrame parent_instance;
+ GtkBin parent_instance;
EtLogAreaPrivate *priv;
};
struct _EtLogAreaClass
{
/*< private >*/
- GtkFrameClass parent_class;
+ GtkBinClass parent_class;
};
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]