Use less silly properties
This commit is contained in:
parent
48c5bbcb9f
commit
958a8fb753
@ -47,5 +47,6 @@ syntax: regexp
|
||||
^moo/mooedit/plugins/Makefile\.am
|
||||
^moo/moofileview/Makefile\.am
|
||||
^moo/mooapp/Makefile\.am
|
||||
^moo/mooapp/mooapp-credits\.h
|
||||
^moo/mooutils/Makefile\.am
|
||||
^moo/mooutils/stock-(moo|medit)\.h
|
||||
|
@ -10,8 +10,8 @@ MODULE = medit
|
||||
bin_PROGRAMS = medit
|
||||
|
||||
EXTRA_DIST += main.c
|
||||
medit_SOURCES = medit-credits.h $(real_main_c) mem-debug.h
|
||||
BUILT_SOURCES += medit-credits.h $(real_main_c) medit.iss
|
||||
medit_SOURCES = $(real_main_c) mem-debug.h
|
||||
BUILT_SOURCES += $(real_main_c) medit.iss
|
||||
nodist_medit_SOURCES =
|
||||
|
||||
real_main_c = main.c
|
||||
@ -29,10 +29,6 @@ medit_LDADD = $(moo_sublibs) $(MOO_LIBS)
|
||||
|
||||
medit_RC_IN_FILE = medit.rc.in
|
||||
|
||||
medit-credits.h: ../THANKS $(top_srcdir)/ugly/xml2h.sh
|
||||
$(SHELL) $(top_srcdir)/ugly/xml2h.sh THANKS $(srcdir)/../THANKS > $@.tmp && \
|
||||
mv $@.tmp $(srcdir)/medit-credits.h
|
||||
|
||||
EXTRA_DIST += medit.desktop.in
|
||||
|
||||
@MOO_INTLTOOL_DESKTOP_RULE@
|
||||
|
10
medit/main.c
10
medit/main.c
@ -371,18 +371,8 @@ main (int argc, char *argv[])
|
||||
gdk_threads_enter ();
|
||||
|
||||
app = MOO_APP (g_object_new (medit_app_get_type (),
|
||||
"argv", argv,
|
||||
"run-input", run_input,
|
||||
"use-session", medit_opts.use_session,
|
||||
"short-name", "medit",
|
||||
"full-name", "medit",
|
||||
"description", _("medit is a text editor"),
|
||||
"website", "http://mooedit.sourceforge.net/",
|
||||
"website-label", "http://mooedit.sourceforge.net/",
|
||||
"quit-on-editor-close", TRUE,
|
||||
"logo", "medit",
|
||||
/* static string, not copied! */
|
||||
"credits", THANKS,
|
||||
"instance-name", medit_opts.app_name,
|
||||
NULL));
|
||||
|
||||
|
@ -3,8 +3,10 @@ mooapp_sources = \
|
||||
mooappabout.h \
|
||||
mooapp.c \
|
||||
mooapp.h \
|
||||
mooapp-private.h \
|
||||
mooapp-accels.h \
|
||||
mooapp-credits.h \
|
||||
mooapp-info.h \
|
||||
mooapp-private.h \
|
||||
moohtml.h \
|
||||
moohtml.c \
|
||||
moolinklabel.h \
|
||||
@ -14,9 +16,15 @@ noinst_LTLIBRARIES = libmooapp.la
|
||||
libmooapp_la_SOURCES = $(mooapp_sources)
|
||||
libmooapp_la_LIBADD = libsmclient.la
|
||||
|
||||
BUILT_SOURCES += mooapp-credits.h
|
||||
|
||||
GLADE_FILES = glade/mooappabout.glade
|
||||
|
||||
AM_CFLAGS = $(MOO_CFLAGS)
|
||||
AM_CXXFLAGS = $(MOO_CXXFLAGS)
|
||||
|
||||
include smclient/Makefile.incl
|
||||
|
||||
mooapp-credits.h: ../../THANKS $(top_srcdir)/ugly/xml2h.sh
|
||||
$(SHELL) $(top_srcdir)/ugly/xml2h.sh MOO_APP_CREDITS $(srcdir)/../../THANKS > $@.tmp && \
|
||||
mv $@.tmp $(srcdir)/mooapp-credits.h
|
||||
|
24
moo/mooapp/mooapp-info.h
Normal file
24
moo/mooapp/mooapp-info.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* mooapp-info.h
|
||||
*
|
||||
* Copyright (C) 2004-2008 by Yevgen Muntyan <muntyan@tamu.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#ifndef MOO_APP_INFO_H
|
||||
#define MOO_APP_INFO_H
|
||||
|
||||
#define MOO_APP_SHORT_NAME "medit"
|
||||
#define MOO_APP_FULL_NAME "medit"
|
||||
#define MOO_APP_DESCRIPTION _("medit is a text editor")
|
||||
#define MOO_APP_LOGO "medit"
|
||||
#define MOO_APP_VERSION PACKAGE_VERSION
|
||||
#define MOO_APP_WEBSITE "http://mooedit.sourceforge.net/"
|
||||
#define MOO_APP_WEBSITE_LABEL "http://mooedit.sourceforge.net/"
|
||||
|
||||
#endif /* MOO_APP_INFO_H */
|
@ -19,6 +19,7 @@
|
||||
#include "mooapp-private.h"
|
||||
#include "smclient/eggsmclient.h"
|
||||
#include "mooapp-accels.h"
|
||||
#include "mooapp-info.h"
|
||||
#include "mooedit/mooeditprefs.h"
|
||||
#include "mooedit/mooeditor.h"
|
||||
#include "mooedit/mooplugin.h"
|
||||
@ -80,10 +81,7 @@ static struct {
|
||||
static volatile int signal_received;
|
||||
|
||||
struct _MooAppPrivate {
|
||||
char **argv;
|
||||
int exit_code;
|
||||
MooEditor *editor;
|
||||
MooAppInfo info;
|
||||
char *rc_files[2];
|
||||
|
||||
gboolean run_input;
|
||||
@ -100,8 +98,6 @@ struct _MooAppPrivate {
|
||||
MooUIXML *ui_xml;
|
||||
const char *default_ui;
|
||||
guint quit_handler_id;
|
||||
gboolean use_editor;
|
||||
gboolean quit_on_editor_close;
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
IgeMacDock *dock;
|
||||
@ -130,9 +126,6 @@ static void moo_app_get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void moo_app_set_argv (MooApp *app,
|
||||
char **argv);
|
||||
|
||||
static gboolean moo_app_init_real (MooApp *app);
|
||||
static int moo_app_run_real (MooApp *app);
|
||||
static void moo_app_quit_real (MooApp *app);
|
||||
@ -150,14 +143,6 @@ static GtkWidget *moo_app_create_prefs_dialog (MooApp *app);
|
||||
static void moo_app_load_prefs (MooApp *app);
|
||||
static void moo_app_save_prefs (MooApp *app);
|
||||
|
||||
static void moo_app_set_name (MooApp *app,
|
||||
const char *short_name,
|
||||
const char *full_name);
|
||||
static void moo_app_set_description (MooApp *app,
|
||||
const char *description);
|
||||
static void moo_app_set_version (MooApp *app,
|
||||
const char *version);
|
||||
|
||||
static void moo_app_save_session (MooApp *app);
|
||||
static void moo_app_write_session (MooApp *app);
|
||||
|
||||
@ -199,20 +184,9 @@ moo_app_get_type (void)
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_ARGV,
|
||||
PROP_SHORT_NAME,
|
||||
PROP_FULL_NAME,
|
||||
PROP_VERSION,
|
||||
PROP_DESCRIPTION,
|
||||
PROP_RUN_INPUT,
|
||||
PROP_USE_SESSION,
|
||||
PROP_USE_EDITOR,
|
||||
PROP_QUIT_ON_EDITOR_CLOSE,
|
||||
PROP_DEFAULT_UI,
|
||||
PROP_LOGO,
|
||||
PROP_WEBSITE,
|
||||
PROP_WEBSITE_LABEL,
|
||||
PROP_CREDITS,
|
||||
PROP_INSTANCE_NAME
|
||||
};
|
||||
|
||||
@ -253,70 +227,6 @@ moo_app_class_init (MooAppClass *klass)
|
||||
klass->load_session = moo_app_load_session_real;
|
||||
klass->save_session = moo_app_save_session_real;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ARGV,
|
||||
g_param_spec_boxed ("argv",
|
||||
"argv",
|
||||
"Null-terminated array of application arguments",
|
||||
G_TYPE_STRV,
|
||||
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SHORT_NAME,
|
||||
g_param_spec_string ("short-name",
|
||||
"short-name",
|
||||
"short-name",
|
||||
"ggap",
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_FULL_NAME,
|
||||
g_param_spec_string ("full-name",
|
||||
"full-name",
|
||||
"full-name",
|
||||
NULL,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_VERSION,
|
||||
g_param_spec_string ("version",
|
||||
"version",
|
||||
"version",
|
||||
NULL,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_WEBSITE,
|
||||
g_param_spec_string ("website",
|
||||
"website",
|
||||
"website",
|
||||
NULL,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_WEBSITE_LABEL,
|
||||
g_param_spec_string ("website-label",
|
||||
"website-label",
|
||||
"website-label",
|
||||
NULL,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_DESCRIPTION,
|
||||
g_param_spec_string ("description",
|
||||
"description",
|
||||
"description",
|
||||
NULL,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_LOGO,
|
||||
g_param_spec_string ("logo",
|
||||
"logo",
|
||||
"logo",
|
||||
NULL,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_RUN_INPUT,
|
||||
g_param_spec_boolean ("run-input",
|
||||
@ -341,30 +251,10 @@ moo_app_class_init (MooAppClass *klass)
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_USE_EDITOR,
|
||||
g_param_spec_boolean ("use-editor",
|
||||
"use-editor",
|
||||
"use-editor",
|
||||
TRUE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_QUIT_ON_EDITOR_CLOSE,
|
||||
g_param_spec_boolean ("quit-on-editor-close",
|
||||
"quit-on-editor-close",
|
||||
"quit-on-editor-close",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_DEFAULT_UI,
|
||||
g_param_spec_pointer ("default-ui", "default-ui", "default-ui",
|
||||
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_CREDITS,
|
||||
g_param_spec_pointer ("credits", "credits", "credits",
|
||||
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
signals[INIT] =
|
||||
g_signal_new ("init",
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
@ -455,10 +345,6 @@ moo_app_instance_init (MooApp *app)
|
||||
|
||||
app->priv = g_new0 (MooAppPrivate, 1);
|
||||
app->priv->use_session = -1;
|
||||
|
||||
app->priv->info.version = g_strdup (APP_VERSION);
|
||||
app->priv->info.website = g_strdup ("http://ggap.sourceforge.net/");
|
||||
app->priv->info.website_label = g_strdup ("http://ggap.sourceforge.net");
|
||||
}
|
||||
|
||||
|
||||
@ -499,10 +385,7 @@ moo_app_constructor (GType type,
|
||||
object = moo_app_parent_class->constructor (type, n_params, params);
|
||||
app = MOO_APP (object);
|
||||
|
||||
g_set_prgname (app->priv->info.short_name);
|
||||
|
||||
if (!app->priv->info.full_name)
|
||||
app->priv->info.full_name = g_strdup (app->priv->info.short_name);
|
||||
g_set_prgname (MOO_APP_SHORT_NAME);
|
||||
|
||||
#if defined(HAVE_SIGNAL) && defined(SIGINT)
|
||||
setup_signals (sigint_handler);
|
||||
@ -532,8 +415,6 @@ moo_app_finalize (GObject *object)
|
||||
if (app->priv->session)
|
||||
moo_markup_doc_unref (app->priv->session);
|
||||
|
||||
if (app->priv->argv)
|
||||
g_strfreev (app->priv->argv);
|
||||
if (app->priv->editor)
|
||||
g_object_unref (app->priv->editor);
|
||||
if (app->priv->ui_xml)
|
||||
@ -556,37 +437,6 @@ moo_app_set_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ARGV:
|
||||
moo_app_set_argv (app, (char**) g_value_get_boxed (value));
|
||||
break;
|
||||
|
||||
case PROP_SHORT_NAME:
|
||||
moo_app_set_name (app, g_value_get_string (value), NULL);
|
||||
break;
|
||||
|
||||
case PROP_FULL_NAME:
|
||||
moo_app_set_name (app, NULL, g_value_get_string (value));
|
||||
break;
|
||||
|
||||
case PROP_VERSION:
|
||||
moo_app_set_version (app, g_value_get_string (value));
|
||||
break;
|
||||
|
||||
case PROP_WEBSITE:
|
||||
g_free (app->priv->info.website);
|
||||
app->priv->info.website = g_strdup (g_value_get_string (value));
|
||||
g_object_notify (G_OBJECT (app), "website");
|
||||
break;
|
||||
case PROP_WEBSITE_LABEL:
|
||||
g_free (app->priv->info.website_label);
|
||||
app->priv->info.website_label = g_strdup (g_value_get_string (value));
|
||||
g_object_notify (G_OBJECT (app), "website_label");
|
||||
break;
|
||||
|
||||
case PROP_DESCRIPTION:
|
||||
moo_app_set_description (app, g_value_get_string (value));
|
||||
break;
|
||||
|
||||
case PROP_RUN_INPUT:
|
||||
app->priv->run_input = g_value_get_boolean (value);
|
||||
break;
|
||||
@ -600,28 +450,10 @@ moo_app_set_property (GObject *object,
|
||||
app->priv->instance_name = g_value_dup_string (value);
|
||||
break;
|
||||
|
||||
case PROP_USE_EDITOR:
|
||||
app->priv->use_editor = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_QUIT_ON_EDITOR_CLOSE:
|
||||
app->priv->quit_on_editor_close = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_DEFAULT_UI:
|
||||
app->priv->default_ui = g_value_get_pointer (value);
|
||||
break;
|
||||
|
||||
case PROP_LOGO:
|
||||
g_free (app->priv->info.logo);
|
||||
app->priv->info.logo = g_strdup (g_value_get_string (value));
|
||||
g_object_notify (G_OBJECT (app), "logo");
|
||||
break;
|
||||
|
||||
case PROP_CREDITS:
|
||||
app->priv->info.credits = g_value_get_pointer (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
@ -637,28 +469,6 @@ moo_app_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_SHORT_NAME:
|
||||
g_value_set_string (value, app->priv->info.short_name);
|
||||
break;
|
||||
case PROP_FULL_NAME:
|
||||
g_value_set_string (value, app->priv->info.full_name);
|
||||
break;
|
||||
|
||||
case PROP_VERSION:
|
||||
g_value_set_string (value, app->priv->info.version);
|
||||
break;
|
||||
|
||||
case PROP_DESCRIPTION:
|
||||
g_value_set_string (value, app->priv->info.description);
|
||||
break;
|
||||
|
||||
case PROP_WEBSITE:
|
||||
g_value_set_string (value, app->priv->info.website);
|
||||
break;
|
||||
case PROP_WEBSITE_LABEL:
|
||||
g_value_set_string (value, app->priv->info.website_label);
|
||||
break;
|
||||
|
||||
case PROP_RUN_INPUT:
|
||||
g_value_set_boolean (value, app->priv->run_input);
|
||||
break;
|
||||
@ -669,14 +479,6 @@ moo_app_get_property (GObject *object,
|
||||
g_value_set_string (value, app->priv->instance_name);
|
||||
break;
|
||||
|
||||
case PROP_USE_EDITOR:
|
||||
g_value_set_boolean (value, app->priv->use_editor);
|
||||
break;
|
||||
|
||||
case PROP_QUIT_ON_EDITOR_CLOSE:
|
||||
g_value_set_boolean (value, app->priv->quit_on_editor_close);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
@ -690,25 +492,6 @@ moo_app_get_instance (void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
moo_app_set_argv (MooApp *app,
|
||||
char **argv)
|
||||
{
|
||||
g_strfreev (app->priv->argv);
|
||||
app->priv->argv = g_strdupv (argv);
|
||||
g_object_notify (G_OBJECT (app), "argv");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
moo_app_set_exit_code (MooApp *app,
|
||||
int code)
|
||||
{
|
||||
g_return_if_fail (MOO_IS_APP (app));
|
||||
app->priv->exit_code = code;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
moo_app_python_run_file (MooApp *app,
|
||||
const char *filename)
|
||||
@ -771,14 +554,6 @@ moo_app_get_editor (MooApp *app)
|
||||
}
|
||||
|
||||
|
||||
const MooAppInfo *
|
||||
moo_app_get_info (MooApp *app)
|
||||
{
|
||||
g_return_val_if_fail (MOO_IS_APP (app), NULL);
|
||||
return &app->priv->info;
|
||||
}
|
||||
|
||||
|
||||
#ifdef MOO_BUILD_EDIT
|
||||
static gboolean
|
||||
close_editor_window (MooApp *app)
|
||||
@ -786,8 +561,7 @@ close_editor_window (MooApp *app)
|
||||
GSList *windows;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
if (!app->priv->running || app->priv->in_try_quit ||
|
||||
!app->priv->quit_on_editor_close)
|
||||
if (!app->priv->running || app->priv->in_try_quit)
|
||||
return FALSE;
|
||||
|
||||
windows = moo_editor_list_windows (app->priv->editor);
|
||||
@ -823,7 +597,7 @@ moo_app_init_editor (MooApp *app)
|
||||
moo_editor_set_ui_xml (app->priv->editor,
|
||||
moo_app_get_ui_xml (app));
|
||||
moo_editor_set_app_name (app->priv->editor,
|
||||
app->priv->info.short_name);
|
||||
MOO_APP_SHORT_NAME);
|
||||
|
||||
init_plugins (app);
|
||||
}
|
||||
@ -917,8 +691,8 @@ moo_app_init_mac (G_GNUC_UNUSED MooApp *app)
|
||||
static gboolean
|
||||
moo_app_init_real (MooApp *app)
|
||||
{
|
||||
gdk_set_program_class (app->priv->info.full_name);
|
||||
gtk_window_set_default_icon_name (app->priv->info.short_name);
|
||||
gdk_set_program_class (MOO_APP_FULL_NAME);
|
||||
gtk_window_set_default_icon_name (MOO_APP_SHORT_NAME);
|
||||
|
||||
_moo_set_app_instance_name (app->priv->instance_name);
|
||||
|
||||
@ -927,7 +701,6 @@ moo_app_init_real (MooApp *app)
|
||||
moo_app_init_mac (app);
|
||||
|
||||
#ifdef MOO_BUILD_EDIT
|
||||
if (app->priv->use_editor)
|
||||
moo_app_init_editor (app);
|
||||
|
||||
if (app->priv->use_session == -1)
|
||||
@ -1129,7 +902,7 @@ moo_app_run_real (MooApp *app)
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return app->priv->exit_code;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -1248,46 +1021,6 @@ moo_app_quit (MooApp *app)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
moo_app_set_name (MooApp *app,
|
||||
const char *short_name,
|
||||
const char *full_name)
|
||||
{
|
||||
if (short_name)
|
||||
{
|
||||
g_free (app->priv->info.short_name);
|
||||
app->priv->info.short_name = g_strdup (short_name);
|
||||
g_object_notify (G_OBJECT (app), "short_name");
|
||||
}
|
||||
|
||||
if (full_name)
|
||||
{
|
||||
g_free (app->priv->info.full_name);
|
||||
app->priv->info.full_name = g_strdup (full_name);
|
||||
g_object_notify (G_OBJECT (app), "full_name");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
moo_app_set_description (MooApp *app,
|
||||
const char *description)
|
||||
{
|
||||
g_free (app->priv->info.description);
|
||||
app->priv->info.description = g_strdup (description);
|
||||
g_object_notify (G_OBJECT (app), "description");
|
||||
}
|
||||
|
||||
static void
|
||||
moo_app_set_version (MooApp *app,
|
||||
const char *version)
|
||||
{
|
||||
g_free (app->priv->info.version);
|
||||
app->priv->info.version = g_strdup (version);
|
||||
g_object_notify (G_OBJECT (app), "version");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
install_common_actions (void)
|
||||
{
|
||||
@ -1773,11 +1506,10 @@ static GtkWidget *
|
||||
moo_app_create_prefs_dialog (MooApp *app)
|
||||
{
|
||||
char *title;
|
||||
const MooAppInfo *info;
|
||||
MooPrefsDialog *dialog;
|
||||
|
||||
info = moo_app_get_info (app);
|
||||
title = g_strdup_printf ("%s Preferences", info->full_name);
|
||||
/* Prefs dialog title, like "medit Preferences" */
|
||||
title = g_strdup_printf (_("%s Preferences"), MOO_APP_FULL_NAME);
|
||||
dialog = MOO_PREFS_DIALOG (moo_prefs_dialog_new (title));
|
||||
g_free (title);
|
||||
|
||||
|
@ -27,22 +27,9 @@ G_BEGIN_DECLS
|
||||
|
||||
|
||||
typedef struct _MooApp MooApp;
|
||||
typedef struct _MooAppInfo MooAppInfo;
|
||||
typedef struct _MooAppPrivate MooAppPrivate;
|
||||
typedef struct _MooAppClass MooAppClass;
|
||||
|
||||
struct _MooAppInfo
|
||||
{
|
||||
char *short_name;
|
||||
char *full_name;
|
||||
char *description;
|
||||
char *version;
|
||||
char *website;
|
||||
char *website_label;
|
||||
char *logo;
|
||||
const char *credits;
|
||||
};
|
||||
|
||||
struct _MooApp
|
||||
{
|
||||
GObject parent;
|
||||
@ -85,11 +72,6 @@ gboolean moo_app_quit (MooApp *app);
|
||||
|
||||
void moo_app_load_session (MooApp *app);
|
||||
|
||||
void moo_app_set_exit_code (MooApp *app,
|
||||
int code);
|
||||
|
||||
const MooAppInfo*moo_app_get_info (MooApp *app);
|
||||
|
||||
MooEditor *moo_app_get_editor (MooApp *app);
|
||||
|
||||
void moo_app_prefs_dialog (GtkWidget *parent);
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "mooappabout-glade.h"
|
||||
#include "mooappabout.h"
|
||||
#include "mooapp.h"
|
||||
#include "mooapp-credits.h"
|
||||
#include "mooapp-info.h"
|
||||
#include "moohtml.h"
|
||||
#include "moolinklabel.h"
|
||||
#include "mooutils/moostock.h"
|
||||
@ -86,10 +88,6 @@ show_credits (void)
|
||||
GtkTextView *written_by;
|
||||
GtkTextView *thanks;
|
||||
GtkTextBuffer *buffer;
|
||||
const MooAppInfo *info;
|
||||
|
||||
info = moo_app_get_info (moo_app_get_instance());
|
||||
g_return_if_fail (info && info->credits);
|
||||
|
||||
if (credits_dialog)
|
||||
{
|
||||
@ -128,7 +126,7 @@ show_credits (void)
|
||||
|
||||
thanks = moo_glade_xml_get_widget (xml, "thanks");
|
||||
buffer = gtk_text_view_get_buffer (thanks);
|
||||
gtk_text_buffer_insert_at_cursor (buffer, info->credits, -1);
|
||||
gtk_text_buffer_insert_at_cursor (buffer, MOO_APP_CREDITS, -1);
|
||||
|
||||
if (about_dialog)
|
||||
moo_window_set_parent (credits_dialog, about_dialog);
|
||||
@ -166,12 +164,11 @@ create_about_dialog (void)
|
||||
{
|
||||
MooGladeXML *xml;
|
||||
GtkWidget *dialog, *logo, *button;
|
||||
const MooAppInfo *info;
|
||||
char *markup;
|
||||
GtkLabel *label;
|
||||
MooLinkLabel *url;
|
||||
GtkStockItem dummy;
|
||||
|
||||
info = moo_app_get_info (moo_app_get_instance());
|
||||
xml = moo_glade_xml_new_empty (GETTEXT_PACKAGE);
|
||||
moo_glade_xml_map_id (xml, "url", MOO_TYPE_LINK_LABEL);
|
||||
moo_glade_xml_parse_memory (xml, mooappabout_glade_xml, -1, "dialog", NULL);
|
||||
@ -185,12 +182,12 @@ create_about_dialog (void)
|
||||
|
||||
label = moo_glade_xml_get_widget (xml, "name");
|
||||
markup = g_strdup_printf ("<span size=\"xx-large\"><b>%s-%s</b></span>",
|
||||
info->full_name, info->version);
|
||||
MOO_APP_FULL_NAME, MOO_APP_VERSION);
|
||||
gtk_label_set_markup (label, markup);
|
||||
g_free (markup);
|
||||
|
||||
label = moo_glade_xml_get_widget (xml, "description");
|
||||
gtk_label_set_text (label, info->description);
|
||||
gtk_label_set_text (label, MOO_APP_DESCRIPTION);
|
||||
|
||||
label = moo_glade_xml_get_widget (xml, "copyright");
|
||||
markup = g_strdup_printf ("<small>%s</small>", copyright);
|
||||
@ -198,26 +195,17 @@ create_about_dialog (void)
|
||||
g_free (markup);
|
||||
|
||||
url = moo_glade_xml_get_widget (xml, "url");
|
||||
_moo_link_label_set_url (url, info->website);
|
||||
_moo_link_label_set_text (url, info->website_label);
|
||||
_moo_link_label_set_url (url, MOO_APP_WEBSITE);
|
||||
_moo_link_label_set_text (url, MOO_APP_WEBSITE_LABEL);
|
||||
|
||||
logo = moo_glade_xml_get_widget (xml, "logo");
|
||||
|
||||
if (info->logo)
|
||||
{
|
||||
GtkStockItem dummy;
|
||||
|
||||
if (gtk_stock_lookup (info->logo, &dummy))
|
||||
gtk_image_set_from_stock (GTK_IMAGE (logo), info->logo,
|
||||
if (gtk_stock_lookup (MOO_APP_LOGO, &dummy))
|
||||
gtk_image_set_from_stock (GTK_IMAGE (logo), MOO_APP_LOGO,
|
||||
GTK_ICON_SIZE_DIALOG);
|
||||
else
|
||||
gtk_image_set_from_icon_name (GTK_IMAGE (logo), info->logo,
|
||||
gtk_image_set_from_icon_name (GTK_IMAGE (logo), MOO_APP_LOGO,
|
||||
GTK_ICON_SIZE_DIALOG);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_hide (logo);
|
||||
}
|
||||
|
||||
button = moo_glade_xml_get_widget (xml, "credits_button");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (show_credits), NULL);
|
||||
@ -281,15 +269,12 @@ moo_app_get_system_info (MooApp *app)
|
||||
GString *text;
|
||||
char *string;
|
||||
char **dirs, **p;
|
||||
const MooAppInfo *app_info;
|
||||
|
||||
g_return_val_if_fail (MOO_IS_APP (app), NULL);
|
||||
|
||||
text = g_string_new (NULL);
|
||||
|
||||
app_info = moo_app_get_info (app);
|
||||
g_return_val_if_fail (app_info != NULL, NULL);
|
||||
g_string_append_printf (text, "%s-%s\n", app_info->full_name, app_info->version);
|
||||
g_string_append_printf (text, "%s-%s\n", MOO_APP_FULL_NAME, MOO_APP_VERSION);
|
||||
|
||||
#ifdef __WIN32__
|
||||
string = get_windows_name ();
|
||||
|
@ -32,21 +32,6 @@
|
||||
(return-type "gboolean")
|
||||
)
|
||||
|
||||
(define-method set_exit_code
|
||||
(of-object "MooApp")
|
||||
(c-name "moo_app_set_exit_code")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("int" "code")
|
||||
)
|
||||
)
|
||||
|
||||
;; (define-method get_info
|
||||
;; (of-object "MooApp")
|
||||
;; (c-name "moo_app_get_info")
|
||||
;; (return-type "const-MooAppInfo*")
|
||||
;; )
|
||||
|
||||
(define-function prefs_dialog
|
||||
(c-name "moo_app_prefs_dialog")
|
||||
(return-type "none")
|
||||
|
Loading…
x
Reference in New Issue
Block a user