[gtk+/wip/gapplication] Cleanups
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/gapplication] Cleanups
- Date: Fri, 4 Jun 2010 05:13:12 +0000 (UTC)
commit 1db1525e3d7c5eac2c9c9d1002926a55d12128f5
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jun 4 00:23:21 2010 -0400
Cleanups
docs/reference/gtk/gtk3.types | 1 +
gtk/gtkapplication.c | 94 ++++++++++++++++++++++------------------
2 files changed, 53 insertions(+), 42 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3.types b/docs/reference/gtk/gtk3.types
index 873c63b..b03bb0c 100644
--- a/docs/reference/gtk/gtk3.types
+++ b/docs/reference/gtk/gtk3.types
@@ -11,6 +11,7 @@ gtk_action_group_get_type
gtk_activatable_get_type
gtk_adjustment_get_type
gtk_alignment_get_type
+gtk_application_get_type
gtk_arrow_get_type
gtk_aspect_frame_get_type
gtk_assistant_get_type
diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c
index cb57f7d..724e8c8 100644
--- a/gtk/gtkapplication.c
+++ b/gtk/gtkapplication.c
@@ -9,7 +9,7 @@
*
* This library 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
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
@@ -33,6 +33,8 @@
#include "gtkintl.h"
#include "gtkprivate.h"
+#include "gtkalias.h"
+
#include <gdk/gdk.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/x11/gdkx.h>
@@ -48,7 +50,7 @@ struct _GtkApplicationPrivate
{
char *appid;
GtkActionGroup *main_actions;
-
+
GtkWindow *default_window;
};
@@ -65,7 +67,8 @@ static const GApplicationPlugin app_plugin = {
};
static gboolean
-gtk_application_default_quit (GApplication *application, guint timestamp)
+gtk_application_default_quit (GApplication *application,
+ guint timestamp)
{
gtk_main_quit ();
return TRUE;
@@ -78,11 +81,13 @@ gtk_application_default_run (GApplication *application)
}
static void
-gtk_application_default_action (GApplication *application, const char *action, guint timestamp)
+gtk_application_default_action (GApplication *application,
+ const gchar *action,
+ guint timestamp)
{
GtkApplication *app = GTK_APPLICATION (application);
GList *actions, *iter;
-
+
actions = gtk_action_group_list_actions (app->priv->main_actions);
for (iter = actions; iter; iter = iter->next)
{
@@ -100,7 +105,7 @@ gtk_application_default_action (GApplication *application, const char *action, g
static void
gtk_application_format_activation_data (GVariantBuilder *builder)
{
- const char *startup_id = NULL;
+ const gchar *startup_id = NULL;
GdkDisplay *display = gdk_display_get_default ();
/* try and get the startup notification id from GDK, the environment
@@ -111,8 +116,8 @@ gtk_application_format_activation_data (GVariantBuilder *builder)
#endif /* GDK_WINDOWING_X11 */
if (startup_id)
- g_variant_builder_add (builder, "{sv}", "startup-notification-id",
- g_variant_new ("s", startup_id));
+ g_variant_builder_add (builder, "{sv}", "startup-notification-id",
+ g_variant_new ("s", startup_id));
}
static void
@@ -125,10 +130,9 @@ gtk_application_receive_activation_data (GVariant *data)
g_variant_iter_init (&iter, data);
while (g_variant_iter_next (&iter, "{sv}", &key, &value))
{
- if (!strcmp (key, "startup-notification-id") && !strcmp (g_variant_get_type_string (value), "s"))
- {
- gdk_notify_startup_complete_with_id (g_variant_get_string (value, NULL));
- }
+ if (strcmp (key, "startup-notification-id") == 0 &&
+ strcmp (g_variant_get_type_string (value), "s") == 0)
+ gdk_notify_startup_complete_with_id (g_variant_get_string (value, NULL));
g_free (key);
g_variant_unref (value);
}
@@ -141,8 +145,8 @@ gtk_application_receive_activation_data (GVariant *data)
* @appid: System-dependent application identifier
*
* Create a new #GtkApplication, or if one has already been initialized
- * in this process, return the existing instance. This function will as a side effect
- * initialize the display system; see gtk_init().
+ * in this process, return the existing instance. This function will as
+ * a side effect initialize the display system; see gtk_init().
*
* For the behavior if this application is running in another process,
* see g_application_new().
@@ -150,12 +154,12 @@ gtk_application_receive_activation_data (GVariant *data)
* Returns: (transfer full): A newly-referenced #GtkApplication
*/
GtkApplication*
-gtk_application_new (int *argc,
- char ***argv,
- const char *appid)
-{
- int argc_for_app;
- char **argv_for_app;
+gtk_application_new (gint *argc,
+ gchar ***argv,
+ const gchar *appid)
+{
+ gint argc_for_app;
+ gchar **argv_for_app;
gtk_init (argc, argv);
@@ -168,18 +172,21 @@ gtk_application_new (int *argc,
else
argv_for_app = NULL;
- return GTK_APPLICATION (g_application_new_subtype (argc_for_app, argv_for_app, appid, GTK_TYPE_APPLICATION, &app_plugin));
+ return GTK_APPLICATION (g_application_new_subtype (argc_for_app,
+ argv_for_app,
+ appid,
+ GTK_TYPE_APPLICATION,
+ &app_plugin));
}
static void
on_action_sensitive (GtkAction *action,
- GParamSpec *pspec,
- GtkApplication *app)
+ GParamSpec *pspec,
+ GtkApplication *app)
{
-
- g_application_set_action_enabled (G_APPLICATION (app),
- gtk_action_get_name (action),
- gtk_action_get_sensitive (action));
+ g_application_set_action_enabled (G_APPLICATION (app),
+ gtk_action_get_name (action),
+ gtk_action_get_sensitive (action));
}
/**
@@ -187,8 +194,9 @@ on_action_sensitive (GtkAction *action,
* @app: A #GtkApplication
* @group: A #GtkActionGroup
*
- * Set @group as this application's global action group. This will
- * ensure the operating system interface uses these actions as follows:
+ * Set @group as this application's global action group.
+ * This will ensure the operating system interface uses
+ * these actions as follows:
*
* <itemizedlist>
* <listitem>In GNOME 2 this exposes the actions for scripting.<listitem>
@@ -208,7 +216,7 @@ gtk_application_set_action_group (GtkApplication *app,
g_return_if_fail (GTK_IS_APPLICATION (app));
g_return_if_fail (app->priv->main_actions == NULL);
-
+
app->priv->main_actions = g_object_ref (group);
actions = gtk_action_group_list_actions (group);
for (iter = actions; iter; iter = iter->next)
@@ -217,18 +225,20 @@ gtk_application_set_action_group (GtkApplication *app,
g_application_add_action (G_APPLICATION (app),
gtk_action_get_name (action),
gtk_action_get_tooltip (action));
- g_signal_connect (action, "notify::sensitive", G_CALLBACK (on_action_sensitive), app);
+ g_signal_connect (action, "notify::sensitive",
+ G_CALLBACK (on_action_sensitive), app);
}
g_list_free (actions);
}
static gboolean
-gtk_application_on_window_destroy (GtkWidget *window,
- gpointer user_data)
+gtk_application_on_window_destroy (GtkWidget *window,
+ gpointer user_data)
{
GtkApplication *app = GTK_APPLICATION (user_data);
gtk_application_quit (app);
+
return FALSE;
}
@@ -266,11 +276,11 @@ gtk_application_get_window (GtkApplication *app)
* gtk_application_run:
* @app: a #GtkApplication
*
- * Runs the main loop; see g_application_run(). The default
- * implementation for #GtkApplication uses gtk_main().
+ * Runs the main loop; see g_application_run().
+ * The default implementation for #GtkApplication uses gtk_main().
*/
void
-gtk_application_run (GtkApplication *app)
+gtk_application_run (GtkApplication *app)
{
g_application_run (G_APPLICATION (app));
}
@@ -279,8 +289,8 @@ gtk_application_run (GtkApplication *app)
* gtk_application_quit:
* @app: a #GtkApplication
*
- * Request the application exit. By default, this
- * method will exit the main loop; see gtk_main_quit().
+ * Request the application exit.
+ * By default, this method will exit the main loop; see gtk_main_quit().
*/
void
gtk_application_quit (GtkApplication *app)
@@ -313,7 +323,7 @@ gtk_application_set_property (GObject *object,
GParamSpec *pspec)
{
GtkApplication *app = GTK_APPLICATION (object);
-
+
g_assert (app != NULL);
switch (prop_id)
@@ -336,11 +346,11 @@ gtk_application_constructor (GType type,
GObjectConstructParam *construct_params)
{
GObject *object;
-
+
object = (* G_OBJECT_CLASS (gtk_application_parent_class)->constructor) (type,
n_construct_properties,
construct_params);
-
+
return object;
}
@@ -356,7 +366,7 @@ gtk_application_class_init (GtkApplicationClass *klass)
gobject_class->constructor = gtk_application_constructor;
gobject_class->get_property = gtk_application_get_property;
gobject_class->set_property = gtk_application_set_property;
-
+
application_class->run = gtk_application_default_run;
application_class->quit = gtk_application_default_quit;
application_class->action = gtk_application_default_action;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]