[gnome-calendar] application: More code style cleanup and reorganization
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] application: More code style cleanup and reorganization
- Date: Tue, 30 Jan 2018 03:31:38 +0000 (UTC)
commit 503191377fbaf8966714caf743ad745ecffb51e3
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Jan 30 01:30:59 2018 -0200
application: More code style cleanup and reorganization
src/gcal-application.c | 35 +++++++++++++----------------------
src/main.c | 2 ++
2 files changed, 15 insertions(+), 22 deletions(-)
---
diff --git a/src/gcal-application.c b/src/gcal-application.c
index be8301b4..94e06c8e 100644
--- a/src/gcal-application.c
+++ b/src/gcal-application.c
@@ -583,11 +583,9 @@ on_about_response (GtkAboutDialog *about,
static gchar*
build_about_copyright (GcalApplication *self)
{
- GString *builder ; /* owned */
- const gchar *attribution; /* unowned */
g_autoptr (GDateTime) dt = NULL;
-
- g_return_val_if_fail (GCAL_IS_APPLICATION (self), NULL);
+ const gchar *attribution;
+ GString *builder;
builder = g_string_new ("<span size=\"small\">");
dt = g_date_time_new_now_local ();
@@ -598,7 +596,7 @@ build_about_copyright (GcalApplication *self)
g_date_time_get_year (dt));
attribution = gcal_weather_service_get_attribution (self->weather_service);
- if (attribution != NULL)
+ if (attribution)
{
g_string_append_c (builder, '\n');
g_string_append (builder, attribution);
@@ -613,8 +611,10 @@ gcal_application_show_about (GSimpleAction *simple,
GVariant *parameter,
gpointer user_data)
{
- GcalApplication *self; /* unowned */
- GtkWidget *dialog; /* owned */
+ GcalApplication *self;
+ GtkWidget *dialog;
+ GtkLabel *copyright_label;
+ g_autofree gchar *copyright = NULL;
const gchar *authors[] = {
"Erick Pérez Castellanos <erickpc gnome org>",
@@ -646,19 +646,12 @@ gcal_application_show_about (GSimpleAction *simple,
"translator-credits", _("translator-credits"),
NULL);
- /* Poke AboutDialog internals to display links in
- * attributions. This workaround is also used by
- * gnome-weather.
- */
- {
- g_autofree gchar *copyright;
- GObject *cpyright_lbl; /* unowned */
-
- copyright = build_about_copyright (self);
- cpyright_lbl = gtk_widget_get_template_child (GTK_WIDGET (dialog), GTK_TYPE_ABOUT_DIALOG,
"copyright_label");
- gtk_label_set_markup (GTK_LABEL (cpyright_lbl), copyright);
- gtk_widget_show (GTK_WIDGET (cpyright_lbl));
- }
+ copyright = build_about_copyright (self);
+ copyright_label = GTK_LABEL (gtk_widget_get_template_child (GTK_WIDGET (dialog),
+ GTK_TYPE_ABOUT_DIALOG,
+ "copyright_label"));
+ gtk_label_set_markup (copyright_label, copyright);
+ gtk_widget_show (GTK_WIDGET (copyright_label));
g_signal_connect (dialog, "response", G_CALLBACK (on_about_response), NULL);
gtk_widget_show (dialog);
@@ -678,8 +671,6 @@ gcal_application_quit (GSimpleAction *simple,
GcalApplication*
gcal_application_new (void)
{
- g_set_application_name ("Calendar");
-
return g_object_new (gcal_application_get_type (),
"resource-base-path", "/org/gnome/calendar",
"application-id", "org.gnome.Calendar",
diff --git a/src/main.c b/src/main.c
index d08d1421..a3a0fc93 100644
--- a/src/main.c
+++ b/src/main.c
@@ -33,6 +33,8 @@ main (int argc,
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
+ g_set_application_name ("Calendar");
+
app = gcal_application_new ();
return g_application_run (G_APPLICATION (app), argc, argv);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]