Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=gservice.git;a=commitdiff;h=c39e4807ba516f5261184b79221aca578dbbe805

commit c39e4807ba516f5261184b79221aca578dbbe805
Author: Priyank <[email protected]>
Date:   Tue Dec 30 00:43:02 2008 +0530

Added an about dialog

diff --git a/data/gservice.glade b/data/gservice.glade
index d3989f9..e5040ac 100644
--- a/data/gservice.glade
+++ b/data/gservice.glade
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.5 on Tue Dec 30 00:18:28 2008 -->
+<!--Generated with glade3 3.4.5 on Tue Dec 30 00:42:03 2008 -->
<glade-interface>
<widget class="GtkWindow" id="gsvc_main_window">
<property name="width_request">650</property>
@@ -101,7 +101,7 @@
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK 
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
-                      <widget class="GtkImageMenuItem" id="imagemenuitem10">
+                      <widget class="GtkImageMenuItem" id="menu_about">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK 
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">gtk-about</property>
diff --git a/src/Makefile.am b/src/Makefile.am
index d6d6f21..434ed29 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,6 +8,7 @@ gservice_SOURCES=                                               
        \
gservice.c                              \
gservice-backend.c              \
gservice-interface.c    \
-                                       gservice-messages.c
+                                       gservice-messages.c             \
+                                       gservice-about.c

gservice_LDADD= @GSERVICE_LIBS@
diff --git a/src/gservice-about.c b/src/gservice-about.c
new file mode 100644
index 0000000..055b367
--- /dev/null
+++ b/src/gservice-about.c
@@ -0,0 +1,113 @@
+/*
+ *  gservice-about.c for gservice
+ *
+ *  Copyright (C) 2008 by Priyank Gosalia <[email protected]>
+ *
+ *  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.
+ *
+ *  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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gtk/gtk.h>
+#include "gservice.h"
+#include "gservice-about.h"
+
+static gchar   *license =
+("This program is free software; you can redistribute it and/or "
+"modify it under the terms of the GNU General Public Licence as "
+"published by the Free Software Foundation; either version 2 of the "
+"Licence, or (at your option) any later version.\n"
+"\n"
+"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 Licence for more details.\n"
+"\n"
+"You should have received a copy of the GNU General Public Licence "
+"along with this program; if not, write to the Free Software "
+"Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, "
+"MA  02110-1301  USA");
+
+
+extern GtkWidget *gsvc_main_window;
+static GtkWidget *about_dlg = NULL;
+static GdkPixbuf *about_pixbuf = NULL;
+static const gchar *authors[] = { \
+                               "Priyank M. Gosalia <[email protected]>",
+                               NULL
+                       };
+
+static const gchar *artists[] = { \
+                               "Frugalware Logo - Viktor Gondor 
<[email protected]>",
+                               NULL
+                       };
+
+static const gchar translators[] = "";
+
+static void gservice_about_dlg_create (void);
+static void gservice_about_dlg_hide (void);
+
+static void
+gservice_about_dlg_create (void)
+{
+       gchar *ver = NULL;
+       GList *list;
+
+       if (!about_pixbuf)
+               about_pixbuf = NULL;
+       about_dlg = gtk_about_dialog_new ();
+       gtk_about_dialog_set_name (GTK_ABOUT_DIALOG(about_dlg), PACKAGE);
+       gtk_about_dialog_set_version (GTK_ABOUT_DIALOG(about_dlg), VERSION);
+       gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG(about_dlg), _("(C) 
2008 Frugalware Developer Team (GPL)"));
+       gtk_about_dialog_set_comments (GTK_ABOUT_DIALOG(about_dlg), _("A 
graphical runlevel editor for Frugalware Linux"));
+       gtk_about_dialog_set_license (GTK_ABOUT_DIALOG(about_dlg), license);
+       gtk_about_dialog_set_website (GTK_ABOUT_DIALOG(about_dlg), 
"http://www.frugalware.org/";);
+       gtk_about_dialog_set_website_label (GTK_ABOUT_DIALOG(about_dlg), 
"http://www.frugalware.org/";);
+       gtk_about_dialog_set_logo (GTK_ABOUT_DIALOG(about_dlg), about_pixbuf);
+       gtk_about_dialog_set_wrap_license (GTK_ABOUT_DIALOG(about_dlg), TRUE);
+       gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG(about_dlg), authors);
+       gtk_about_dialog_set_artists (GTK_ABOUT_DIALOG(about_dlg), artists);
+       gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG(about_dlg), 
translators);
+       g_signal_connect (G_OBJECT(about_dlg), "destroy", 
G_CALLBACK(gtk_widget_destroyed), &about_dlg);
+
+       list = gtk_container_get_children 
(GTK_CONTAINER((GTK_DIALOG(about_dlg))->action_area));
+       list = list->next;
+       list = list->next;
+       g_signal_connect (G_OBJECT(list->data), "clicked", 
G_CALLBACK(gservice_about_dlg_hide), NULL);
+
+       return;
+}
+
+static void
+gservice_about_dlg_hide (void)
+{
+       gtk_widget_hide (about_dlg);
+
+       return;
+}
+
+void
+gservice_about (void)
+{
+       if (about_dlg == NULL)
+               gservice_about_dlg_create ();
+
+       gtk_widget_show (about_dlg);
+
+       return;
+}
+
diff --git a/src/gservice-about.h b/src/gservice-about.h
new file mode 100644
index 0000000..58a611c
--- /dev/null
+++ b/src/gservice-about.h
@@ -0,0 +1,8 @@
+#ifndef __GSERVICE_ABOUT_H
+#define __GSERVICE_ABOUT_H
+
+/* displays the about dialog */
+void gservice_about (void);
+
+#endif
+
diff --git a/src/gservice-interface.c b/src/gservice-interface.c
index f012130..7c3fc4a 100644
--- a/src/gservice-interface.c
+++ b/src/gservice-interface.c
@@ -20,6 +20,7 @@

#include "gservice-interface.h"
#include "gservice-backend.h"
+#include "gservice-about.h"

GtkWidget               *gsvc_main_window = NULL;
static GtkWidget        *gsvc_button_start = NULL;
@@ -288,6 +289,13 @@ gservice_interface_init (void)
gservice_setup_treeview ();
gservice_populate_services ();

+       /* connect some signals */
+       g_signal_connect (G_OBJECT(glade_xml_get_widget(xml,"menu_about")),
+                               "activate",
+                               G_CALLBACK(gservice_about),
+                               NULL);
+
+       /* alrite, lets display the main window */
gtk_widget_show (gsvc_main_window);

return;
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to