Merge lp:~ricotz/granite/aboutdialog into lp:~elementary-pantheon/granite/granite

Proposed by Rico Tzschichholz
Status: Merged
Approved by: David Gomes
Approved revision: 451
Merged at revision: 452
Proposed branch: lp:~ricotz/granite/aboutdialog
Merge into: lp:~elementary-pantheon/granite/granite
Diff against target: 224 lines (+47/-135)
5 files modified
lib/Application.vala (+46/-24)
lib/CMakeLists.txt (+0/-2)
lib/Widgets/AboutDialog.vala (+1/-2)
lib/Widgets/widgets-utils.c (+0/-101)
lib/Widgets/widgets-utils.h (+0/-6)
To merge this branch: bzr merge lp:~ricotz/granite/aboutdialog
Reviewer Review Type Date Requested Status
David Gomes (community) Approve
Review via email: mp+133995@code.launchpad.net

Description of the change

Replace the c-source handling the presentation of AboutDialog with vala

To post a comment you must log in.
Revision history for this message
David Gomes (davidgomes) wrote :

+1 for replacing this C part with Vala.
Code Style approved and my not-very-thourough tests passed.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/Application.vala'
2--- lib/Application.vala 2012-11-10 19:18:57 +0000
3+++ lib/Application.vala 2012-11-12 21:25:25 +0000
4@@ -148,31 +148,53 @@
5 */
6 public virtual void show_about (Gtk.Widget parent) {
7
8- assert(parent is Gtk.Window);
9- Granite.Widgets.show_about_dialog ((Gtk.Window) parent,
10- "program_name", program_name,
11- "version", build_version,
12- "logo_icon_name", app_icon,
13-
14- "comments", about_comments,
15- "copyright", "%s %s Developers".printf (app_years, program_name),
16- "website", main_url,
17- "website_label", "Website",
18-
19- "authors", about_authors,
20- "documenters", about_documenters,
21- "artists", about_artists,
22- "translator_credits", about_translators,
23- "license", about_license,
24- "license_type", about_license_type,
25-
26- "help", help_url,
27- "translate", translate_url,
28- "bug", bug_url);
29-
30+ assert (parent is Gtk.Window);
31+
32+ Granite.Widgets.AboutDialog dialog;
33+
34+ if (parent != null)
35+ dialog = parent.get_data ("gtk-about-dialog");
36+ else
37+ dialog = about_dlg;
38+
39+ if (dialog == null) {
40+ dialog = new Granite.Widgets.AboutDialog ();
41+
42+ dialog.program_name = program_name;
43+ dialog.version = build_version;
44+ dialog.logo_icon_name = app_icon;
45+
46+ dialog.comments = about_comments;
47+ dialog.copyright = "%s %s Developers".printf (app_years, program_name);
48+ dialog.website = main_url;
49+ dialog.website_label = "Website";
50+
51+ dialog.authors = about_authors;
52+ dialog.documenters = about_documenters;
53+ dialog.artists = about_artists;
54+ dialog.translator_credits = about_translators;
55+ dialog.license = about_license;
56+ dialog.license_type = about_license_type;
57+
58+ dialog.help = help_url;
59+ dialog.translate = translate_url;
60+ dialog.bug = bug_url;
61+
62+ dialog.delete_event.connect (dialog.hide_on_delete);
63+ dialog.response.connect (() => { dialog.hide (); });
64+
65+ if (parent != null) {
66+ dialog.set_modal (true);
67+ dialog.set_transient_for (parent as Gtk.Window);
68+ dialog.set_destroy_with_parent (true);
69+ parent.set_data_full ("gtk-about-dialog", dialog, Object.unref);
70+ } else {
71+ about_dlg = dialog;
72+ }
73+ }
74+
75+ dialog.present ();
76 }
77-
78 }
79-
80 }
81
82
83=== modified file 'lib/CMakeLists.txt'
84--- lib/CMakeLists.txt 2012-11-11 09:34:55 +0000
85+++ lib/CMakeLists.txt 2012-11-12 21:25:25 +0000
86@@ -104,9 +104,7 @@
87 install (FILES ${CMAKE_CURRENT_BINARY_DIR}/granite.vapi DESTINATION ${CMAKE_INSTALL_PREFIX}/share/vala/vapi/)
88 install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/granite.deps DESTINATION ${CMAKE_INSTALL_PREFIX}/share/vala/vapi/)
89 install (FILES ${CMAKE_CURRENT_BINARY_DIR}/granite.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/granite/)
90-install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/Widgets/widgets-utils.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/granite/)
91 add_library (${PKGNAME} SHARED
92- Widgets/widgets-utils.c
93 Widgets/close-button.c
94 ${VALA_C}
95 )
96
97=== modified file 'lib/Widgets/AboutDialog.vala'
98--- lib/Widgets/AboutDialog.vala 2012-11-08 23:49:23 +0000
99+++ lib/Widgets/AboutDialog.vala 2012-11-12 21:25:25 +0000
100@@ -193,6 +193,5 @@
101 });
102 }
103 }
104-
105- public extern void show_about_dialog (Gtk.Window *parent, ...);
106 }
107+
108
109=== removed file 'lib/Widgets/widgets-utils.c'
110--- lib/Widgets/widgets-utils.c 2011-10-12 12:27:13 +0000
111+++ lib/Widgets/widgets-utils.c 1970-01-01 00:00:00 +0000
112@@ -1,101 +0,0 @@
113-/* GTK - The GIMP Toolkit
114- * Copyright (C) 2001 CodeFactory AB
115- * Copyright (C) 2001, 2002 Anders Carlsson
116- * Copyright (C) 2003, 2004 Matthias Clasen <mclasen@redhat.com>
117- *
118- * This library is free software; you can redistribute it and/or
119- * modify it under the terms of the GNU Library General Public
120- * License as published by the Free Software Foundation; either
121- * version 2 of the License, or (at your option) any later version.
122- *
123- * This library is distributed in the hope that it will be useful,
124- * but WITHOUT ANY WARRANTY; without even the implied warranty of
125- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
126- * Library General Public License for more details.
127- *
128- * You should have received a copy of the GNU Library General Public
129- * License along with this library; if not, write to the
130- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
131- * Boston, MA 02111-1307, USA.
132- */
133-
134-/*
135- * Author: Anders Carlsson <andersca@gnome.org>
136- *
137- * Modified by the GTK+ Team and others 1997-2004. See the AUTHORS
138- * file for a list of people on the GTK+ Team. See the ChangeLog
139- * files for a list of changes. These files are distributed with
140- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
141- */
142-
143-#include "widgets-utils.h"
144-
145-static void
146-close_cb (GtkWidget *about)
147-{
148- GtkAboutDialogPrivate *priv = about->priv;
149-
150- gtk_widget_hide (about);
151-}
152-
153-/**
154- * gtk_show_about_dialog:
155- * @parent: (allow-none): transient parent, or %NULL for none
156- * @first_property_name: the name of the first property
157- * @Varargs: value of first property, followed by more properties, %NULL-terminated
158- *
159- * This is a convenience function for showing an application's about box.
160- * The constructed dialog is associated with the parent window and
161- * reused for future invocations of this function.
162- *
163- * Since: 2.6
164- */
165-void
166- granite_widgets_show_about_dialog (GtkWindow *parent,
167- const gchar *first_property_name,
168- ...)
169-{
170- static GtkWidget *global_about_dialog = NULL;
171- GtkWidget *dialog = NULL;
172- va_list var_args;
173-
174- if (parent)
175- dialog = g_object_get_data (G_OBJECT (parent), "gtk-about-dialog");
176- else
177- dialog = global_about_dialog;
178-
179- if (!dialog)
180- {
181- //dialog = gtk_about_dialog_new ();
182- dialog = granite_widgets_about_dialog_new ();
183- g_object_ref_sink (dialog);
184-
185- g_signal_connect (dialog, "delete-event",
186- G_CALLBACK (gtk_widget_hide_on_delete), NULL);
187-
188- /* Close dialog on user response */
189- g_signal_connect (dialog, "response",
190- G_CALLBACK (close_cb), NULL);
191-
192- va_start (var_args, first_property_name);
193- g_object_set_valist (G_OBJECT (dialog), first_property_name, var_args);
194- va_end (var_args);
195-
196- if (parent)
197- {
198- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
199- gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
200- gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
201- g_object_set_data_full (G_OBJECT (parent),
202- "gtk-about-dialog",
203- dialog, g_object_unref);
204- }
205- else
206- global_about_dialog = dialog;
207-
208- }
209-
210- gtk_window_present (GTK_WINDOW (dialog));
211-}
212-
213-
214
215=== removed file 'lib/Widgets/widgets-utils.h'
216--- lib/Widgets/widgets-utils.h 2011-10-12 12:27:13 +0000
217+++ lib/Widgets/widgets-utils.h 1970-01-01 00:00:00 +0000
218@@ -1,6 +0,0 @@
219-#include <glib.h>
220-#include <gtk/gtk.h>
221-
222-void granite_widgets_show_about_dialog (GtkWindow *parent,
223- const gchar *first_property_name,
224- ...);

Subscribers

People subscribed via source and target branches