attachment:ui_shell.c of UMEGuide/ApplicationDevelopment/PortingCAppsToUME


Attachment 'ui_shell.c'

Download

Toggle line numbers
   1 /**
   2  * @file ui_shell.c UI handling
   3  *
   4  * Copyright (C) 2007 Lars Lindner <lars.lindner@gmail.com>
   5  *
   6  * This library is free software; you can redistribute it and/or
   7  * modify it under the terms of the GNU Library General Public
   8  * License as published by the Free Software Foundation; either
   9  * version 2 of the License, or (at your option) any later version.
  10  * 
  11  * This library is distributed in the hope that it will be useful,
  12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14  * Library General Public License for more details.
  15  * 
  16  * You should have received a copy of the GNU Library General Public License
  17  * along with this library; see the file COPYING.LIB.  If not, write to
  18  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19  * Boston, MA 02111-1307, USA.
  20  */
  21 
  22 #ifdef HAVE_CONFIG_H
  23 #  include <config.h>
  24 #endif
  25 
  26 #include <gtk/gtk.h>
  27 #include <glade/glade.h>
  28 
  29 #include "ui/ui_shell.h"
  30 
  31 static void liferea_shell_class_init	(LifereaShellClass *klass);
  32 static void liferea_shell_init		(LifereaShell *ls);
  33 
  34 #define LIFEREA_SHELL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), LIFEREA_SHELL_TYPE, LifereaShellPrivate))
  35 
  36 struct LifereaShellPrivate {
  37 	GladeXML	*xml;
  38 
  39 	GtkWidget	*mainwindow;
  40 };
  41 
  42 static GObjectClass *parent_class = NULL;
  43 
  44 LifereaShell *liferea_shell = NULL;
  45 
  46 GType
  47 liferea_shell_get_type (void) 
  48 {
  49 	static GType type = 0;
  50 
  51 	if (G_UNLIKELY (type == 0)) 
  52 	{
  53 		static const GTypeInfo our_info = 
  54 		{
  55 			sizeof (LifereaShellClass),
  56 			NULL, /* base_init */
  57 			NULL, /* base_finalize */
  58 			(GClassInitFunc) liferea_shell_class_init,
  59 			NULL,
  60 			NULL, /* class_data */
  61 			sizeof (LifereaShell),
  62 			0, /* n_preallocs */
  63 			(GInstanceInitFunc) liferea_shell_init
  64 		};
  65 
  66 		type = g_type_register_static (G_TYPE_OBJECT,
  67 					       "LifereaShell",
  68 					       &our_info, 0);
  69 	}
  70 
  71 	return type;
  72 }
  73 
  74 static void
  75 liferea_shell_finalize (GObject *object)
  76 {
  77 	LifereaShell *ls = LIFEREA_SHELL (object);
  78 	
  79 	g_object_unref (ls->priv->xml);
  80 
  81 	G_OBJECT_CLASS (parent_class)->finalize (object);
  82 }
  83 
  84 static void
  85 liferea_shell_class_init (LifereaShellClass *klass)
  86 {
  87 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
  88 
  89 	parent_class = g_type_class_peek_parent (klass);
  90 
  91 	object_class->finalize = liferea_shell_finalize;
  92 
  93 	g_type_class_add_private (object_class, sizeof(LifereaShellPrivate));
  94 }
  95 
  96 GtkWidget *
  97 liferea_shell_lookup (const gchar *name)
  98 {
  99 	g_return_val_if_fail (liferea_shell != NULL, NULL);
 100 	g_return_val_if_fail (liferea_shell->priv != NULL, NULL);
 101 
 102 	return glade_xml_get_widget (liferea_shell->priv->xml, name);
 103 }
 104 
 105 static void
 106 liferea_shell_init (LifereaShell *ls)
 107 {
 108 	/* globally accessible singleton */
 109 	g_assert (NULL == liferea_shell);
 110 	liferea_shell = ls;
 111 	
 112 	ls->priv = LIFEREA_SHELL_GET_PRIVATE (ls);
 113 #ifdef MAEMO_CHANGES
 114 	ls->priv->xml = glade_xml_new (PACKAGE_DATA_DIR G_DIR_SEPARATOR_S PACKAGE G_DIR_SEPARATOR_S "liferea_hildon.glade", "mainwindow", GETTEXT_PACKAGE);
 115 #else
 116 	ls->priv->xml = glade_xml_new (PACKAGE_DATA_DIR G_DIR_SEPARATOR_S PACKAGE G_DIR_SEPARATOR_S "liferea.glade", "mainwindow", GETTEXT_PACKAGE);
 117 #endif
 118 	glade_xml_signal_autoconnect (ls->priv->xml);
 119 }
 120 
 121 void
 122 liferea_shell_create (void)
 123 {
 124 	g_object_new (LIFEREA_SHELL_TYPE, NULL);
 125 }

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2007-09-29 18:23:59, 2.0 KB) [[attachment:Makefile.am]]
  • [get | view] (2007-09-29 18:27:09, 0.9 KB) [[attachment:Makefile.am from ui directory]]
  • [get | view] (2007-09-29 18:19:25, 16.5 KB) [[attachment:configure.ac]]
  • [get | view] (2007-09-29 18:46:32, 110.7 KB) [[attachment:hildonized.png]]
  • [get | view] (2007-09-29 19:02:18, 6630.1 KB) [[attachment:liferea-1.4.2b.tar.gz]]
  • [get | view] (2007-09-29 18:31:43, 286.9 KB) [[attachment:liferea.glade]]
  • [get | view] (2007-09-29 18:43:07, 91.2 KB) [[attachment:liferea.png]]
  • [get | view] (2007-09-29 18:32:30, 286.8 KB) [[attachment:liferea_hildon.glade]]
  • [get | view] (2007-09-29 18:47:27, 62.2 KB) [[attachment:liferea_maemo.png]]
  • [get | view] (2007-09-29 18:28:40, 0.9 KB) [[attachment:ui makefile]]
  • [get | view] (2007-09-29 18:30:47, 0.9 KB) [[attachment:ui_Makefile.am]]
  • [get | view] (2007-09-29 18:36:26, 4.1 KB) [[attachment:ui_dialog.c]]
  • [get | view] (2007-09-29 18:53:17, 44.9 KB) [[attachment:ui_mainwindow.c]]
  • [get | view] (2007-09-29 18:35:59, 3.2 KB) [[attachment:ui_shell.c]]
 All files | Selected Files: delete move to page

You are not allowed to attach a file to this page.