Implement MidoriApp::browsers and deprecate MidoriApp::browser-count
This commit is contained in:
parent
92fd37ad61
commit
b89fbb98f2
1 changed files with 41 additions and 6 deletions
|
@ -27,7 +27,6 @@ struct _MidoriApp
|
||||||
{
|
{
|
||||||
GObject parent_instance;
|
GObject parent_instance;
|
||||||
|
|
||||||
GList* browsers;
|
|
||||||
MidoriBrowser* browser;
|
MidoriBrowser* browser;
|
||||||
GtkAccelGroup* accel_group;
|
GtkAccelGroup* accel_group;
|
||||||
|
|
||||||
|
@ -37,6 +36,7 @@ struct _MidoriApp
|
||||||
KatzeArray* search_engines;
|
KatzeArray* search_engines;
|
||||||
KatzeArray* history;
|
KatzeArray* history;
|
||||||
KatzeArray* extensions;
|
KatzeArray* extensions;
|
||||||
|
KatzeArray* browsers;
|
||||||
|
|
||||||
gpointer instance;
|
gpointer instance;
|
||||||
};
|
};
|
||||||
|
@ -65,6 +65,7 @@ enum
|
||||||
PROP_SEARCH_ENGINES,
|
PROP_SEARCH_ENGINES,
|
||||||
PROP_HISTORY,
|
PROP_HISTORY,
|
||||||
PROP_EXTENSIONS,
|
PROP_EXTENSIONS,
|
||||||
|
PROP_BROWSERS,
|
||||||
PROP_BROWSER,
|
PROP_BROWSER,
|
||||||
PROP_BROWSER_COUNT
|
PROP_BROWSER_COUNT
|
||||||
};
|
};
|
||||||
|
@ -127,8 +128,8 @@ static gboolean
|
||||||
midori_browser_destroy_cb (MidoriBrowser* browser,
|
midori_browser_destroy_cb (MidoriBrowser* browser,
|
||||||
MidoriApp* app)
|
MidoriApp* app)
|
||||||
{
|
{
|
||||||
app->browsers = g_list_remove (app->browsers, browser);
|
katze_array_remove_item (app->browsers, browser);
|
||||||
if (g_list_nth (app->browsers, 0))
|
if (!katze_array_is_empty (app->browsers))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
midori_app_quit (app);
|
midori_app_quit (app);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -157,7 +158,7 @@ _midori_app_add_browser (MidoriApp* app,
|
||||||
"signal::quit", midori_browser_quit_cb, app,
|
"signal::quit", midori_browser_quit_cb, app,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
app->browsers = g_list_prepend (app->browsers, browser);
|
katze_array_add_item (app->browsers, browser);
|
||||||
|
|
||||||
#if HAVE_UNIQUE
|
#if HAVE_UNIQUE
|
||||||
unique_app_watch_window (app->instance, GTK_WINDOW (browser));
|
unique_app_watch_window (app->instance, GTK_WINDOW (browser));
|
||||||
|
@ -258,6 +259,29 @@ midori_app_class_init (MidoriAppClass* class)
|
||||||
KATZE_TYPE_ARRAY,
|
KATZE_TYPE_ARRAY,
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MidoriApp:browsers:
|
||||||
|
*
|
||||||
|
* The list of browsers.
|
||||||
|
*
|
||||||
|
* Since: 0.1.3
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_BROWSERS,
|
||||||
|
g_param_spec_object (
|
||||||
|
"browsers",
|
||||||
|
"Browsers",
|
||||||
|
"The list of browsers",
|
||||||
|
KATZE_TYPE_ARRAY,
|
||||||
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MidoriApp:browser:
|
||||||
|
*
|
||||||
|
* The current browser, that is the one that was last used.
|
||||||
|
*
|
||||||
|
* Since: 0.1.3
|
||||||
|
*/
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_BROWSER,
|
PROP_BROWSER,
|
||||||
g_param_spec_object (
|
g_param_spec_object (
|
||||||
|
@ -267,6 +291,13 @@ midori_app_class_init (MidoriAppClass* class)
|
||||||
MIDORI_TYPE_BROWSER,
|
MIDORI_TYPE_BROWSER,
|
||||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MidoriApp:browser-count:
|
||||||
|
*
|
||||||
|
* The number of browsers.
|
||||||
|
*
|
||||||
|
* Deprecated: 0.1.3 Use MidoriApp:browsers instead.
|
||||||
|
*/
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_BROWSER_COUNT,
|
PROP_BROWSER_COUNT,
|
||||||
g_param_spec_uint (
|
g_param_spec_uint (
|
||||||
|
@ -374,6 +405,7 @@ midori_app_init (MidoriApp* app)
|
||||||
app->search_engines = NULL;
|
app->search_engines = NULL;
|
||||||
app->history = NULL;
|
app->history = NULL;
|
||||||
app->extensions = NULL;
|
app->extensions = NULL;
|
||||||
|
app->browsers = katze_array_new (MIDORI_TYPE_BROWSER);
|
||||||
|
|
||||||
#if HAVE_UNIQUE
|
#if HAVE_UNIQUE
|
||||||
display_name = g_strdup (gdk_display_get_name (gdk_display_get_default ()));
|
display_name = g_strdup (gdk_display_get_name (gdk_display_get_default ()));
|
||||||
|
@ -397,7 +429,6 @@ midori_app_finalize (GObject* object)
|
||||||
{
|
{
|
||||||
MidoriApp* app = MIDORI_APP (object);
|
MidoriApp* app = MIDORI_APP (object);
|
||||||
|
|
||||||
g_list_free (app->browsers);
|
|
||||||
g_object_unref (app->accel_group);
|
g_object_unref (app->accel_group);
|
||||||
|
|
||||||
katze_object_assign (app->settings, NULL);
|
katze_object_assign (app->settings, NULL);
|
||||||
|
@ -406,6 +437,7 @@ midori_app_finalize (GObject* object)
|
||||||
katze_object_assign (app->search_engines, NULL);
|
katze_object_assign (app->search_engines, NULL);
|
||||||
katze_object_assign (app->history, NULL);
|
katze_object_assign (app->history, NULL);
|
||||||
katze_object_assign (app->extensions, NULL);
|
katze_object_assign (app->extensions, NULL);
|
||||||
|
katze_object_assign (app->browsers, NULL);
|
||||||
|
|
||||||
katze_object_assign (app->instance, NULL);
|
katze_object_assign (app->instance, NULL);
|
||||||
|
|
||||||
|
@ -479,11 +511,14 @@ midori_app_get_property (GObject* object,
|
||||||
case PROP_EXTENSIONS:
|
case PROP_EXTENSIONS:
|
||||||
g_value_set_object (value, app->extensions);
|
g_value_set_object (value, app->extensions);
|
||||||
break;
|
break;
|
||||||
|
case PROP_BROWSERS:
|
||||||
|
g_value_set_object (value, app->browsers);
|
||||||
|
break;
|
||||||
case PROP_BROWSER:
|
case PROP_BROWSER:
|
||||||
g_value_set_object (value, app->browser);
|
g_value_set_object (value, app->browser);
|
||||||
break;
|
break;
|
||||||
case PROP_BROWSER_COUNT:
|
case PROP_BROWSER_COUNT:
|
||||||
g_value_set_uint (value, g_list_length (app->browsers));
|
g_value_set_uint (value, katze_array_get_length (app->browsers));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
|
Loading…
Reference in a new issue