[gnome-notes/wip/igaldino/bijiben-rename] application: Fix coding style
- From: Isaque Galdino de Araujo <igaldino src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-notes/wip/igaldino/bijiben-rename] application: Fix coding style
- Date: Tue, 21 Aug 2018 20:00:51 +0000 (UTC)
commit a65ad49b35be254d9cea44a2bb4778370aacddba
Author: Isaque Galdino <igaldino gmail com>
Date: Tue Aug 21 16:57:55 2018 -0300
application: Fix coding style
Fix application object function names and general coding style.
Related to issue #100.
src/bjb-application.c | 372 +++++++++++++++++++++-----------------------
src/bjb-application.h | 30 ++--
src/bjb-editor-toolbar.c | 6 +-
src/bjb-main-toolbar.c | 16 +-
src/bjb-main-view.c | 6 +-
src/bjb-note-view.c | 2 +-
src/bjb-selection-toolbar.c | 4 +-
src/bjb-settings-dialog.c | 8 +-
src/bjb-window-base.c | 13 +-
9 files changed, 221 insertions(+), 236 deletions(-)
---
diff --git a/src/bjb-application.c b/src/bjb-application.c
index 770650d..df7c806 100644
--- a/src/bjb-application.c
+++ b/src/bjb-application.c
@@ -1,15 +1,15 @@
/*
- * bjb-bijiben.c
+ * bjb-application.c
* Copyright (C) 2011 Pierre-Yves LUYTEN <py luyten fr>
* Copyright (C) 2017 Iñigo Martínez <inigomartinez gmail com>
* Copyright (C) 2017 Mohammed Sadiq <sadiq sadiqpk org>
*
- * bijiben is free software: you can redistribute it and/or modify it
+ * gnome-notes 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 3 of the License, or
* (at your option) any later version.
*
- * bijiben is distributed in the hope that it will be useful, but
+ * gnome-notes 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.
@@ -19,15 +19,11 @@
*/
#include "config.h"
-
#include <glib/gi18n.h>
#include <stdlib.h>
#include <libedataserver/libedataserver.h> /* ESourceRegistry */
#include <libecal/libecal.h> /* ECalClient */
-
-
#include <libbiji/libbiji.h>
-
#include "bjb-application.h"
#include "bjb-settings.h"
#include "bjb-main-view.h"
@@ -37,66 +33,64 @@
struct _BjbApplication
{
- GtkApplication parent_instance;
+ GtkApplication parent_instance;
- BijiManager *manager;
- BjbSettings *settings;
+ BijiManager *manager;
+ BjbSettings *settings;
/* Controls. to_open is for startup */
- gboolean first_run;
- gboolean is_loaded;
- gboolean new_note;
- GQueue files_to_open; // paths
+ gboolean first_run;
+ gboolean is_loaded;
+ gboolean new_note;
+ GQueue files_to_open; // paths
};
G_DEFINE_TYPE (BjbApplication, bjb_application, GTK_TYPE_APPLICATION)
-static void bijiben_new_window_internal (BjbApplication *self,
- BijiNoteObj *note);
-static gboolean bijiben_open_path (BjbApplication *self,
- gchar *path,
- BjbWindowBase *window);
+static gboolean bjb_application_open_path (BjbApplication *self,
+ gchar *path,
+ BjbWindowBase *window);
static void
-on_window_activated_cb (BjbWindowBase *window,
- gboolean available,
- BjbApplication *self)
+bjb_application_on_window_activated_cb (BjbWindowBase *window,
+ gboolean available,
+ BjbApplication *self)
{
- GList *l, *next;
+ GList *l;
+ GList *next;
self->is_loaded = TRUE;
for (l = self->files_to_open.head; l != NULL; l = next)
- {
- next = l->next;
- if (bijiben_open_path (self, l->data, (available ? window : NULL)))
{
- g_free (l->data);
- g_queue_delete_link (&self->files_to_open, l);
+ next = l->next;
+ if (bjb_application_open_path (self, l->data, (available ? window : NULL)))
+ {
+ g_free (l->data);
+ g_queue_delete_link (&self->files_to_open, l);
+ }
}
- }
/* All requested notes are loaded, but we have a new one to create...
* This implementation is not really safe,
* we might have loaded SOME provider(s)
* but not the default one - more work is needed here */
if (self->new_note && g_queue_is_empty (&self->files_to_open))
- {
- BijiItem *item;
-
- self->new_note = FALSE;
- item = BIJI_ITEM (biji_manager_note_new (
- self->manager,
- NULL,
- bjb_settings_get_default_location (self->settings)));
- bijiben_new_window_internal (self, BIJI_NOTE_OBJ (item));
- }
+ {
+ BijiItem *item;
+
+ self->new_note = FALSE;
+ item = BIJI_ITEM (biji_manager_note_new (self->manager,
+ NULL,
+ bjb_settings_get_default_location (self->settings)));
+ bjb_application_show_note_window (self, BIJI_NOTE_OBJ (item));
+ }
}
-static void
-bijiben_new_window_internal (BjbApplication *self,
- BijiNoteObj *note)
+void
+bjb_application_show_note_window (BjbApplication *self,
+ BijiNoteObj *note)
{
BjbWindowBase *window;
GList *windows;
@@ -106,8 +100,7 @@ bijiben_new_window_internal (BjbApplication *self,
not_first_window = (gboolean) g_list_length (windows);
window = BJB_WINDOW_BASE (bjb_window_base_new (note));
- g_signal_connect (window, "activated",
- G_CALLBACK (on_window_activated_cb), self);
+ g_signal_connect (window, "activated", G_CALLBACK (bjb_application_on_window_activated_cb), self);
gtk_widget_show (GTK_WIDGET (window));
@@ -116,9 +109,9 @@ bijiben_new_window_internal (BjbApplication *self,
}
static gboolean
-bijiben_open_path (BjbApplication *self,
- gchar *path,
- BjbWindowBase *window)
+bjb_application_open_path (BjbApplication *self,
+ gchar *path,
+ BjbWindowBase *window)
{
BijiItem *item;
@@ -128,22 +121,15 @@ bijiben_open_path (BjbApplication *self,
item = biji_manager_get_item_at_path (self->manager, path);
if (BIJI_IS_NOTE_OBJ (item) || !window)
- bijiben_new_window_internal (self, BIJI_NOTE_OBJ (item));
+ bjb_application_show_note_window (self, BIJI_NOTE_OBJ (item));
else
bjb_window_base_switch_to_item (window, item);
return TRUE;
}
-void
-bijiben_new_window_for_note (GApplication *app,
- BijiNoteObj *note)
-{
- bijiben_new_window_internal (BJB_APPLICATION (app), note);
-}
-
static void
-bijiben_activate (GApplication *app)
+bjb_application_activate (GApplication *app)
{
GList *windows = gtk_application_get_windows (GTK_APPLICATION (app));
@@ -154,25 +140,24 @@ bijiben_activate (GApplication *app)
/* If the app is already loaded, just open the file.
* Else, keep it under the hood */
-
static void
-bijiben_open (GApplication *application,
- GFile **files,
- gint n_files,
- const gchar *hint)
+bjb_application_open (GApplication *application,
+ GFile **files,
+ gint n_files,
+ const gchar *hint)
{
- BjbApplication *self;
- gint i;
+ BjbApplication *self;
+ gint i;
g_autofree gchar *path = NULL;
self = BJB_APPLICATION (application);
for (i = 0; i < n_files; i++)
- {
- path = g_file_get_parse_name (files[i]);
- if (!bijiben_open_path (self, path, NULL))
- g_queue_push_head (&self->files_to_open, path);
- }
+ {
+ path = g_file_get_parse_name (files[i]);
+ if (!bjb_application_open_path (self, path, NULL))
+ g_queue_push_head (&self->files_to_open, path);
+ }
}
static void
@@ -184,9 +169,9 @@ bjb_application_init (BjbApplication *self)
gtk_window_set_default_icon_name ("org.gnome.Notes");
}
-
static void
-bijiben_import_notes (BjbApplication *self, gchar *uri)
+bjb_application_import_notes (BjbApplication *self,
+ gchar *uri)
{
g_debug ("IMPORT to %s", bjb_settings_get_default_location (self->settings));
@@ -196,40 +181,40 @@ bijiben_import_notes (BjbApplication *self, gchar *uri)
}
static void
-theme_changed (GtkSettings *settings)
+bjb_application_on_theme_changed_cb (GtkSettings *settings)
{
static GtkCssProvider *provider = NULL;
- g_autofree gchar *theme = NULL;
- GdkScreen *screen;
+ g_autofree gchar *theme = NULL;
+ GdkScreen *screen;
g_object_get (settings, "gtk-theme-name", &theme, NULL);
screen = gdk_screen_get_default ();
if (g_str_equal (theme, "Adwaita"))
- {
- if (provider == NULL)
{
- g_autoptr(GFile) file = NULL;
+ if (provider == NULL)
+ {
+ g_autoptr(GFile) file = NULL;
- provider = gtk_css_provider_new ();
- file = g_file_new_for_uri ("resource:///org/gnome/bijiben/Adwaita.css");
- gtk_css_provider_load_from_file (provider, file, NULL);
- }
+ provider = gtk_css_provider_new ();
+ file = g_file_new_for_uri ("resource:///org/gnome/bijiben/Adwaita.css");
+ gtk_css_provider_load_from_file (provider, file, NULL);
+ }
- gtk_style_context_add_provider_for_screen (screen,
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- }
+ gtk_style_context_add_provider_for_screen (screen,
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ }
else if (provider != NULL)
- {
- gtk_style_context_remove_provider_for_screen (screen,
- GTK_STYLE_PROVIDER (provider));
- g_clear_object (&provider);
- }
+ {
+ gtk_style_context_remove_provider_for_screen (screen,
+ GTK_STYLE_PROVIDER (provider));
+ g_clear_object (&provider);
+ }
}
static void
-bjb_apply_style (void)
+bjb_application_apply_style (void)
{
GtkSettings *settings;
@@ -238,19 +223,19 @@ bjb_apply_style (void)
* for a more automatic solution that is still under discussion.
*/
settings = gtk_settings_get_default ();
- g_signal_connect (settings, "notify::gtk-theme-name", G_CALLBACK (theme_changed), NULL);
- theme_changed (settings);
+ g_signal_connect (settings, "notify::gtk-theme-name", G_CALLBACK (bjb_application_on_theme_changed_cb),
NULL);
+ bjb_application_on_theme_changed_cb (settings);
}
static void
-manager_ready_cb (GObject *source,
- GAsyncResult *res,
- gpointer user_data)
+bjb_application_on_manager_ready_cb (GObject *source,
+ GAsyncResult *res,
+ gpointer user_data)
{
- BjbApplication *self = user_data;
- g_autoptr(GError) error = NULL;
- g_autofree gchar *path = NULL;
- g_autofree gchar *uri = NULL;
+ BjbApplication *self = user_data;
+ g_autoptr(GError) error = NULL;
+ g_autofree gchar *path = NULL;
+ g_autofree gchar *uri = NULL;
self->manager = biji_manager_new_finish (res, &error);
g_application_release (G_APPLICATION (self));
@@ -267,34 +252,33 @@ manager_ready_cb (GObject *source,
path = g_build_filename (g_get_user_data_dir (), "tomboy", NULL);
uri = g_filename_to_uri (path, NULL, NULL);
if (g_file_test (path, G_FILE_TEST_EXISTS))
- bijiben_import_notes (self, uri);
+ bjb_application_import_notes (self, uri);
g_free (path);
g_free (uri);
path = g_build_filename (g_get_user_data_dir (), "gnote", NULL);
uri = g_filename_to_uri (path, NULL, NULL);
if (g_file_test (path, G_FILE_TEST_EXISTS))
- bijiben_import_notes (self, uri);
+ bjb_application_import_notes (self, uri);
}
- bijiben_new_window_internal (self, NULL);
+ bjb_application_show_note_window (self, NULL);
}
static void
-bijiben_startup (GApplication *application)
+bjb_application_startup (GApplication *application)
{
- BjbApplication *self;
- g_autofree gchar *storage_path = NULL;
- g_autofree gchar *default_color = NULL;
- g_autoptr(GFile) storage = NULL;
- g_autoptr(GError) error = NULL;
- GdkRGBA color = {0,0,0,0};
-
+ BjbApplication *self;
+ g_autofree gchar *storage_path = NULL;
+ g_autofree gchar *default_color = NULL;
+ g_autoptr(GFile) storage = NULL;
+ g_autoptr(GError) error = NULL;
+ GdkRGBA color = {0,0,0,0};
G_APPLICATION_CLASS (bjb_application_parent_class)->startup (application);
self = BJB_APPLICATION (application);
- bjb_apply_style ();
+ bjb_application_apply_style ();
storage_path = g_build_filename (g_get_user_data_dir (), "bijiben", NULL);
storage = g_file_new_for_path (storage_path);
@@ -313,27 +297,28 @@ bijiben_startup (GApplication *application)
gdk_rgba_parse (&color, default_color);
g_application_hold (application);
- biji_manager_new_async (storage, &color, manager_ready_cb, self);
+ biji_manager_new_async (storage, &color, bjb_application_on_manager_ready_cb, self);
}
static gboolean
-bijiben_application_local_command_line (GApplication *application,
- gchar ***arguments,
- gint *exit_status)
+bjb_application_local_command_line (GApplication *application,
+ gchar ***arguments,
+ gint *exit_status)
{
- BjbApplication *self;
- gboolean version = FALSE;
- gchar **remaining = NULL;
- GOptionContext *context;
- g_autoptr(GError) error = NULL;
- gint argc = 0;
- gchar **argv = NULL;
-
- const GOptionEntry options[] = {
+ BjbApplication *self;
+ gboolean version = FALSE;
+ gchar **remaining = NULL;
+ GOptionContext *context;
+ g_autoptr(GError) error = NULL;
+ gint argc = 0;
+ gchar **argv = NULL;
+
+ const GOptionEntry options[] =
+ {
{ "version", 0, 0, G_OPTION_ARG_NONE, &version,
- N_("Show the application’s version"), NULL},
- { "new-note", 0, 0, G_OPTION_ARG_NONE, &BJB_APPLICATION(application)->new_note,
- N_("Create a new note"), NULL},
+ N_("Show the application’s version"), NULL },
+ { "new-note", 0, 0, G_OPTION_ARG_NONE, &BJB_APPLICATION (application)->new_note,
+ N_("Create a new note"), NULL },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining,
NULL, N_("[FILE…]") },
{ NULL }
@@ -351,48 +336,50 @@ bijiben_application_local_command_line (GApplication *application,
argc = g_strv_length (argv);
if (!g_option_context_parse (context, &argc, &argv, &error))
- {
- /* Translators: this is a fatal error quit message
- * printed on the command line */
- g_printerr ("%s: %s\n", _("Could not parse arguments"), error->message);
+ {
+ /* Translators: this is a fatal error quit message
+ * printed on the command line */
+ g_printerr ("%s: %s\n", _("Could not parse arguments"), error->message);
- *exit_status = EXIT_FAILURE;
- goto out;
- }
+ *exit_status = EXIT_FAILURE;
+ goto out;
+ }
if (version)
- {
- g_print ("%s %s\n", _("GNOME Notes"), VERSION);
- goto out;
- }
+ {
+ g_print ("%s %s\n", _("GNOME Notes"), VERSION);
+ goto out;
+ }
- /* bijiben_startup */
+ /* bjb_application_startup */
g_application_register (application, NULL, &error);
if (error != NULL)
- {
- g_printerr ("%s: %s\n",
- /* Translators: this is a fatal error quit message
- * printed on the command line */
- _("Could not register the application"),
- error->message);
-
- *exit_status = EXIT_FAILURE;
- goto out;
- }
+ {
+ g_printerr ("%s: %s\n",
+ /* Translators: this is a fatal error quit message
+ * printed on the command line */
+ _("Could not register the application"),
+ error->message);
+
+ *exit_status = EXIT_FAILURE;
+ goto out;
+ }
self = BJB_APPLICATION (application);
if (!self->new_note && remaining != NULL)
- {
- gchar **args;
+ {
+ gchar **args;
- for (args = remaining; *args; args++)
- if (!bijiben_open_path (self, *args, NULL))
- g_queue_push_head (&self->files_to_open, g_strdup (*args));
- }
+ for (args = remaining; *args; args++)
+ {
+ if (!bjb_application_open_path (self, *args, NULL))
+ g_queue_push_head (&self->files_to_open, g_strdup (*args));
+ }
+ }
- out:
+out:
g_strfreev (remaining);
g_option_context_free (context);
@@ -400,7 +387,7 @@ bijiben_application_local_command_line (GApplication *application,
}
static void
-bijiben_finalize (GObject *object)
+bjb_application_finalize (GObject *object)
{
BjbApplication *self = BJB_APPLICATION (object);
@@ -416,14 +403,14 @@ static void
bjb_application_class_init (BjbApplicationClass *klass)
{
GApplicationClass *aclass = G_APPLICATION_CLASS (klass);
- GObjectClass *oclass = G_OBJECT_CLASS (klass);
+ GObjectClass *oclass = G_OBJECT_CLASS (klass);
- aclass->activate = bijiben_activate;
- aclass->open = bijiben_open;
- aclass->startup = bijiben_startup;
- aclass->local_command_line = bijiben_application_local_command_line;
+ aclass->activate = bjb_application_activate;
+ aclass->open = bjb_application_open;
+ aclass->startup = bjb_application_startup;
+ aclass->local_command_line = bjb_application_local_command_line;
- oclass->finalize = bijiben_finalize;
+ oclass->finalize = bjb_application_finalize;
}
BjbApplication *
@@ -431,32 +418,27 @@ bjb_application_new (void)
{
return g_object_new (BJB_TYPE_APPLICATION,
"application-id", "org.gnome.Notes",
- "flags", G_APPLICATION_HANDLES_OPEN,
+ "flags", G_APPLICATION_HANDLES_OPEN,
NULL);
}
BijiManager *
-bijiben_get_manager(BjbApplication *self)
+bjb_application_get_manager (BjbApplication *self)
{
return self->manager;
}
-const gchar *
-bijiben_get_bijiben_dir (void)
+BjbSettings *
+bjb_application_get_settings (BjbApplication *self)
{
- return DATADIR;
-}
-
-BjbSettings * bjb_app_get_settings(gpointer application)
-{
- return BJB_APPLICATION(application)->settings;
+ return self->settings;
}
void
-bjb_app_import_notes (BjbApplication *self)
+bjb_application_show_import_dialog (BjbApplication *self)
{
GtkDialog *dialog = bjb_import_dialog_new (GTK_APPLICATION (self));
- gint result = gtk_dialog_run (dialog);
+ gint result = gtk_dialog_run (dialog);
if (result == GTK_RESPONSE_OK)
{
@@ -464,7 +446,7 @@ bjb_app_import_notes (BjbApplication *self)
for (GList *l = locations; l != NULL; l = l->next)
{
g_autofree gchar *uri = g_filename_to_uri (l->data, NULL, NULL);
- bijiben_import_notes (self, uri);
+ bjb_application_import_notes (self, uri);
}
g_list_free_full (locations, g_free);
@@ -475,10 +457,10 @@ bjb_app_import_notes (BjbApplication *self)
}
void
-bjb_app_help (BjbApplication *self)
+bjb_application_show_help_window (BjbApplication *self)
{
- GtkApplication *app = GTK_APPLICATION (self);
- g_autoptr(GError) error = NULL;
+ GtkApplication *app = GTK_APPLICATION (self);
+ g_autoptr(GError) error = NULL;
gtk_show_uri_on_window (gtk_application_get_active_window (app),
"help:bijiben",
@@ -489,34 +471,34 @@ bjb_app_help (BjbApplication *self)
g_warning ("%s", error->message);
}
-
void
-bjb_app_about (BjbApplication *self)
+bjb_application_show_about_dialog (BjbApplication *self)
{
- GtkApplication *app = GTK_APPLICATION (self);
- GList *windows = gtk_application_get_windows (app);
+ GtkApplication *app = GTK_APPLICATION (self);
+ GList *windows = gtk_application_get_windows (app);
- const gchar *authors[] = {
+ const gchar *authors[] =
+ {
"Pierre-Yves Luyten <py luyten fr>",
NULL
};
- const gchar *artists[] = {
+ const gchar *artists[] =
+ {
"William Jon McCann <jmccann redhat com>",
NULL
};
gtk_show_about_dialog (g_list_nth_data (windows, 0),
- "program-name", _("Notes"),
- "comments", _("Simple notebook for GNOME"),
- "license-type", GTK_LICENSE_GPL_3_0,
- "version", VERSION,
- "copyright", "Copyright © 2013 Pierre-Yves Luyten",
- "authors", authors,
- "artists", artists,
+ "program-name", _("Notes"),
+ "comments", _("Simple notebook for GNOME"),
+ "license-type", GTK_LICENSE_GPL_3_0,
+ "version", VERSION,
+ "copyright", "Copyright © 2013 Pierre-Yves Luyten",
+ "authors", authors,
+ "artists", artists,
"translator-credits", _("translator-credits"),
- "website", "https://wiki.gnome.org/Apps/Notes",
- "logo-icon-name", "org.gnome.Notes",
+ "website", "https://wiki.gnome.org/Apps/Notes",
+ "logo-icon-name", "org.gnome.Notes",
NULL);
}
-
diff --git a/src/bjb-application.h b/src/bjb-application.h
index fbad019..2368720 100644
--- a/src/bjb-application.h
+++ b/src/bjb-application.h
@@ -1,14 +1,14 @@
/*
- * bijiben.h
+ * bjb-application.h
* Copyright (C) Pierre-Yves LUYTEN 2011 <py luyten fr>
* Copyright (C) 2017 Mohammed Sadiq <sadiq sadiqpk org>
*
- * bijiben is free software: you can redistribute it and/or modify it
+ * gnome-notes 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 3 of the License, or
* (at your option) any later version.
*
- * bijiben is distributed in the hope that it will be useful, but
+ * gnome-notes 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.
@@ -21,28 +21,28 @@
#include <gtk/gtk.h>
#include <libbiji/libbiji.h>
-
#include "bjb-settings.h"
G_BEGIN_DECLS
-#define BJB_TYPE_APPLICATION (bjb_application_get_type ())
+#define BJB_TYPE_APPLICATION (bjb_application_get_type ())
+#define BJB_APPLICATION_DEFAULT (BJB_APPLICATION (g_application_get_default()))
G_DECLARE_FINAL_TYPE (BjbApplication, bjb_application, BJB, APPLICATION, GtkApplication)
-BjbApplication *bjb_application_new (void);
+BjbApplication *bjb_application_new (void);
+
+BijiManager *bjb_application_get_manager (BjbApplication *self);
+
+BjbSettings *bjb_application_get_settings (BjbApplication *self);
-// Accessors
+void bjb_application_show_note_window (BjbApplication *self,
+ BijiNoteObj *note);
-const gchar *bijiben_get_bijiben_dir (void);
-BijiManager * bijiben_get_manager(BjbApplication *self);
-BjbSettings * bjb_app_get_settings(gpointer application);
+void bjb_application_show_import_dialog (BjbApplication *self);
-// Windows
-void bijiben_new_window_for_note (GApplication *app, BijiNoteObj *note);
+void bjb_application_show_help_window (BjbApplication *self);
-void bjb_app_import_notes (BjbApplication *self);
-void bjb_app_help (BjbApplication *self);
-void bjb_app_about (BjbApplication *self);
+void bjb_application_show_about_dialog (BjbApplication *self);
G_END_DECLS
diff --git a/src/bjb-editor-toolbar.c b/src/bjb-editor-toolbar.c
index 57c20f9..ccb5124 100644
--- a/src/bjb-editor-toolbar.c
+++ b/src/bjb-editor-toolbar.c
@@ -131,6 +131,7 @@ static void
on_link_clicked (GtkButton *button,
BjbEditorToolbar *self)
{
+ BjbApplication *app;
BjbSettings *settings;
const gchar *link;
GtkWidget *window;
@@ -138,6 +139,7 @@ on_link_clicked (GtkButton *button,
GdkRGBA color;
BijiManager *manager;
+ app = BJB_APPLICATION_DEFAULT;
link = biji_note_obj_editor_get_selection (self->note);
if (link == NULL)
@@ -146,7 +148,7 @@ on_link_clicked (GtkButton *button,
window = bjb_note_view_get_base_window (self->view);
manager = bjb_window_base_get_manager(window);
- settings = bjb_app_get_settings (g_application_get_default ());
+ settings = bjb_application_get_settings (app);
result = biji_manager_note_new (manager,
link,
bjb_settings_get_default_location (settings));
@@ -155,7 +157,7 @@ on_link_clicked (GtkButton *button,
if (biji_note_obj_get_rgba (self->note, &color))
biji_note_obj_set_rgba (result, &color);
- bijiben_new_window_for_note (g_application_get_default (), result);
+ bjb_application_show_note_window (app, result);
}
static void
diff --git a/src/bjb-main-toolbar.c b/src/bjb-main-toolbar.c
index 6d279bd..a5a1586 100644
--- a/src/bjb-main-toolbar.c
+++ b/src/bjb-main-toolbar.c
@@ -110,13 +110,13 @@ G_DEFINE_TYPE (BjbMainToolbar, bjb_main_toolbar, GTK_TYPE_HEADER_BAR)
static void
on_about_cb (BjbMainToolbar *self)
{
- bjb_app_about (BJB_APPLICATION (g_application_get_default ()));
+ bjb_application_show_about_dialog (BJB_APPLICATION_DEFAULT);
}
static void
on_import_notes_cb (BjbMainToolbar *self)
{
- bjb_app_import_notes (BJB_APPLICATION (g_application_get_default ()));
+ bjb_application_show_import_dialog (BJB_APPLICATION_DEFAULT);
}
static void
@@ -133,7 +133,7 @@ static void
on_text_size_cb (BjbMainToolbar *self,
GtkWidget *item)
{
- BjbSettings *settings = bjb_app_get_settings (g_application_get_default ());
+ BjbSettings *settings = bjb_application_get_settings (BJB_APPLICATION_DEFAULT);
BjbTextSizeType text_size = g_settings_get_enum (G_SETTINGS (settings), "text-size");
BjbTextSizeType new_text_size = text_size;
@@ -168,7 +168,7 @@ on_preferences_cb (BjbMainToolbar *self)
static void
on_help_cb (BjbMainToolbar *self)
{
- bjb_app_help (BJB_APPLICATION (g_application_get_default ()));
+ bjb_application_show_help_window (BJB_APPLICATION_DEFAULT);
}
static void
@@ -182,7 +182,7 @@ on_new_note_clicked (BjbMainToolbar *self)
/* append note to notebook */
manager = bjb_window_base_get_manager (bjb_main_view_get_window (self->parent));
- settings = bjb_app_get_settings (g_application_get_default ());
+ settings = bjb_application_get_settings (BJB_APPLICATION_DEFAULT);
result = biji_manager_note_new (manager,
NULL,
bjb_settings_get_default_location (settings));
@@ -555,7 +555,7 @@ on_detached_clicked_cb (BjbMainToolbar *self)
note = bjb_window_base_get_note (BJB_WINDOW_BASE (self->window));
bjb_window_base_switch_to (BJB_WINDOW_BASE (self->window),
BJB_WINDOW_BASE_MAIN_VIEW);
- bijiben_new_window_for_note (g_application_get_default (), note);
+ bjb_application_show_note_window (BJB_APPLICATION_DEFAULT, note);
}
static void
@@ -580,7 +580,7 @@ populate_bar_for_note_view (BjbMainToolbar *self)
if (!self->note) /* no reason this would happen */
return;
- settings = bjb_app_get_settings (g_application_get_default());
+ settings = bjb_application_get_settings (BJB_APPLICATION_DEFAULT);
gtk_widget_hide (self->new_button);
gtk_widget_hide (self->style_buttons);
@@ -781,7 +781,7 @@ populate_main_toolbar(BjbMainToolbar *self)
static void
bjb_main_toolbar_setup_menu (BjbMainToolbar *self)
{
- BjbSettings *settings = bjb_app_get_settings (g_application_get_default ());
+ BjbSettings *settings = bjb_application_get_settings (BJB_APPLICATION_DEFAULT);
BjbTextSizeType text_size = g_settings_get_enum (G_SETTINGS (settings), "text-size");
gtk_widget_add_accelerator (self->undo_item, "activate", self->accel, GDK_KEY_z,
diff --git a/src/bjb-main-view.c b/src/bjb-main-view.c
index 5513393..abf93ca 100644
--- a/src/bjb-main-view.c
+++ b/src/bjb-main-view.c
@@ -397,7 +397,7 @@ on_drag_data_received (GtkWidget *widget,
/* FIXME Text is guchar utf 8, conversion to perform */
manager = bjb_window_base_get_manager (self->window);
- settings = bjb_app_get_settings (g_application_get_default ());
+ settings = bjb_application_get_settings (BJB_APPLICATION_DEFAULT);
ret = biji_manager_note_new (manager,
(gchar*) text,
bjb_settings_get_default_location (settings));
@@ -603,7 +603,7 @@ bjb_main_view_constructed(GObject *o)
self = BJB_MAIN_VIEW(o);
- settings = bjb_app_get_settings (g_application_get_default ());
+ settings = bjb_application_get_settings (BJB_APPLICATION_DEFAULT);
type = g_settings_get_enum (G_SETTINGS (settings), "view-type");
gtk_orientable_set_orientation (GTK_ORIENTABLE (self), GTK_ORIENTATION_VERTICAL);
@@ -758,7 +758,7 @@ bjb_main_view_set_view_type (BjbMainView *self, GdMainViewType type)
{
BjbSettings *settings;
- settings = bjb_app_get_settings(g_application_get_default());
+ settings = bjb_application_get_settings (BJB_APPLICATION_DEFAULT);
g_settings_set_enum (G_SETTINGS (settings), "view-type", type);
gd_main_view_set_view_type (self->view, type);
diff --git a/src/bjb-note-view.c b/src/bjb-note-view.c
index 1293a8d..958ea6d 100644
--- a/src/bjb-note-view.c
+++ b/src/bjb-note-view.c
@@ -181,7 +181,7 @@ bjb_note_view_constructed (GObject *obj)
GdkRGBA color;
BjbTextSizeType text_size;
- settings = bjb_app_get_settings(g_application_get_default());
+ settings = bjb_application_get_settings (BJB_APPLICATION_DEFAULT);
/* view new from note deserializes the note-content. */
diff --git a/src/bjb-selection-toolbar.c b/src/bjb-selection-toolbar.c
index eafa2d3..fb2f251 100644
--- a/src/bjb-selection-toolbar.c
+++ b/src/bjb-selection-toolbar.c
@@ -135,8 +135,8 @@ action_pop_up_note_callback (BjbSelectionToolbar *self)
selection = bjb_main_view_get_selected_items (self->view);
for (l=selection; l !=NULL; l=l->next)
{
- bijiben_new_window_for_note (g_application_get_default (),
- BIJI_NOTE_OBJ (l->data));
+ bjb_application_show_note_window (BJB_APPLICATION_DEFAULT,
+ BIJI_NOTE_OBJ (l->data));
}
bjb_main_view_set_selection_mode (self->view, FALSE);
diff --git a/src/bjb-settings-dialog.c b/src/bjb-settings-dialog.c
index 855d06e..039e674 100644
--- a/src/bjb-settings-dialog.c
+++ b/src/bjb-settings-dialog.c
@@ -293,16 +293,16 @@ static void
bjb_settings_dialog_constructed (GObject *object)
{
BjbSettingsDialog *self;
- GApplication *app;
+ BjbApplication *app;
GList *providers;
GdkRGBA color;
G_OBJECT_CLASS (bjb_settings_dialog_parent_class)->constructed (object);
self = BJB_SETTINGS_DIALOG (object);
- app = g_application_get_default ();
- self->manager = bijiben_get_manager (BJB_APPLICATION (app));
- self->settings = bjb_app_get_settings (app);
+ app = BJB_APPLICATION_DEFAULT;
+ self->manager = bjb_application_get_manager (app);
+ self->settings = bjb_application_get_settings (app);
gtk_list_box_set_selection_mode (self->listbox, GTK_SELECTION_NONE);
gtk_list_box_set_header_func (self->listbox, header_func, NULL, NULL);
diff --git a/src/bjb-window-base.c b/src/bjb-window-base.c
index cf0f43e..84872d9 100644
--- a/src/bjb-window-base.c
+++ b/src/bjb-window-base.c
@@ -128,7 +128,7 @@ bjb_window_base_set_property (GObject *object,
static gboolean
on_key_pressed_cb (GtkWidget *w, GdkEvent *event, gpointer user_data)
{
- GApplication *app = g_application_get_default ();
+ BjbApplication *app = BJB_APPLICATION_DEFAULT;
BjbWindowBase *self = BJB_WINDOW_BASE (user_data);
GdkModifierType modifiers;
@@ -161,7 +161,7 @@ on_key_pressed_cb (GtkWidget *w, GdkEvent *event, gpointer user_data)
case GDK_KEY_F1:
if ((event->key.state & modifiers) != GDK_CONTROL_MASK)
{
- bjb_app_help (BJB_APPLICATION (app));
+ bjb_application_show_help_window (app);
return TRUE;
}
break;
@@ -245,11 +245,12 @@ bjb_window_base_configure_event (GtkWidget *widget,
static void
bjb_window_base_constructed (GObject *obj)
{
- BjbWindowBase *self = BJB_WINDOW_BASE (obj);
+ BjbWindowBase *self = BJB_WINDOW_BASE (obj);
+ BjbApplication *app = BJB_APPLICATION_DEFAULT;
G_OBJECT_CLASS (bjb_window_base_parent_class)->constructed (obj);
- self->settings = bjb_app_get_settings ((gpointer) g_application_get_default ());
+ self->settings = bjb_application_get_settings (app);
gtk_window_set_position (GTK_WINDOW (self),GTK_WIN_POS_CENTER);
gtk_window_set_title (GTK_WINDOW (self), _(BIJIBEN_MAIN_WIN_TITLE));
@@ -266,7 +267,7 @@ bjb_window_base_constructed (GObject *obj)
self->entry = NULL;
self->controller = bjb_controller_new
- (bijiben_get_manager (BJB_APPLICATION(g_application_get_default())),
+ (bjb_application_get_manager (app),
GTK_WINDOW (obj),
self->entry );
@@ -541,7 +542,7 @@ bjb_window_base_get_view_type (BjbWindowBase *self)
BijiManager *
bjb_window_base_get_manager(GtkWidget * win)
{
- return bijiben_get_manager (BJB_APPLICATION (g_application_get_default()));
+ return bjb_application_get_manager (BJB_APPLICATION_DEFAULT);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]