shell: Rename shell window to CcWindow
This avoids the confusion of the name gnome-control-center.c and is consistent with all the other classes/files in the project. https://bugzilla.gnome.org/show_bug.cgi?id=692174
This commit is contained in:
parent
408ae4a87c
commit
42974a3c8d
5 changed files with 177 additions and 192 deletions
|
@ -27,8 +27,8 @@ gnome_control_center_SOURCES = \
|
||||||
cc-application.h \
|
cc-application.h \
|
||||||
cc-shell-log.c \
|
cc-shell-log.c \
|
||||||
cc-shell-log.h \
|
cc-shell-log.h \
|
||||||
gnome-control-center.c \
|
cc-window.c \
|
||||||
gnome-control-center.h \
|
cc-window.h \
|
||||||
cc-shell-category-view.c \
|
cc-shell-category-view.c \
|
||||||
cc-shell-category-view.h \
|
cc-shell-category-view.h \
|
||||||
cc-shell-item-view.c \
|
cc-shell-item-view.c \
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "cc-application.h"
|
#include "cc-application.h"
|
||||||
#include "cc-panel-loader.h"
|
#include "cc-panel-loader.h"
|
||||||
#include "cc-shell-log.h"
|
#include "cc-shell-log.h"
|
||||||
#include "gnome-control-center.h"
|
#include "cc-window.h"
|
||||||
|
|
||||||
#ifdef HAVE_CHEESE
|
#ifdef HAVE_CHEESE
|
||||||
#include <cheese-gtk.h>
|
#include <cheese-gtk.h>
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
struct _CcApplicationPrivate
|
struct _CcApplicationPrivate
|
||||||
{
|
{
|
||||||
GnomeControlCenter *window;
|
CcWindow *window;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (CcApplication, cc_application, GTK_TYPE_APPLICATION)
|
G_DEFINE_TYPE (CcApplication, cc_application, GTK_TYPE_APPLICATION)
|
||||||
|
@ -166,15 +166,15 @@ cc_application_command_line (GApplication *application,
|
||||||
|
|
||||||
cc_shell_log_set_debug (verbose);
|
cc_shell_log_set_debug (verbose);
|
||||||
|
|
||||||
gnome_control_center_show (self->priv->window);
|
cc_window_show (self->priv->window);
|
||||||
|
|
||||||
if (search_str)
|
if (search_str)
|
||||||
{
|
{
|
||||||
gnome_control_center_set_search_item (self->priv->window, search_str);
|
cc_window_set_search_item (self->priv->window, search_str);
|
||||||
}
|
}
|
||||||
else if (show_overview)
|
else if (show_overview)
|
||||||
{
|
{
|
||||||
gnome_control_center_set_overview_page (self->priv->window);
|
cc_window_set_overview_page (self->priv->window);
|
||||||
}
|
}
|
||||||
else if (start_panels != NULL && start_panels[0] != NULL)
|
else if (start_panels != NULL && start_panels[0] != NULL)
|
||||||
{
|
{
|
||||||
|
@ -231,7 +231,7 @@ cc_application_activate (GApplication *application)
|
||||||
{
|
{
|
||||||
CcApplication *self = CC_APPLICATION (application);
|
CcApplication *self = CC_APPLICATION (application);
|
||||||
|
|
||||||
gnome_control_center_present (self->priv->window);
|
cc_window_present (self->priv->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -281,7 +281,7 @@ cc_application_startup (GApplication *application)
|
||||||
gtk_application_add_accelerator (GTK_APPLICATION (application),
|
gtk_application_add_accelerator (GTK_APPLICATION (application),
|
||||||
"F1", "app.help", NULL);
|
"F1", "app.help", NULL);
|
||||||
|
|
||||||
self->priv->window = gnome_control_center_new (GTK_APPLICATION (application));
|
self->priv->window = cc_window_new (GTK_APPLICATION (application));
|
||||||
}
|
}
|
||||||
|
|
||||||
static GObject *
|
static GObject *
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "gnome-control-center.h"
|
#include "cc-window.h"
|
||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
@ -41,11 +41,11 @@
|
||||||
|
|
||||||
static void cc_shell_iface_init (CcShellInterface *iface);
|
static void cc_shell_iface_init (CcShellInterface *iface);
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GnomeControlCenter, gnome_control_center, GTK_TYPE_APPLICATION_WINDOW,
|
G_DEFINE_TYPE_WITH_CODE (CcWindow, cc_window, GTK_TYPE_APPLICATION_WINDOW,
|
||||||
G_IMPLEMENT_INTERFACE (CC_TYPE_SHELL, cc_shell_iface_init))
|
G_IMPLEMENT_INTERFACE (CC_TYPE_SHELL, cc_shell_iface_init))
|
||||||
|
|
||||||
#define CONTROL_CENTER_PRIVATE(o) \
|
#define WINDOW_PRIVATE(o) \
|
||||||
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNOME_TYPE_CONTROL_CENTER, GnomeControlCenterPrivate))
|
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_WINDOW, CcWindowPrivate))
|
||||||
|
|
||||||
#define W(b,x) GTK_WIDGET (gtk_builder_get_object (b, x))
|
#define W(b,x) GTK_WIDGET (gtk_builder_get_object (b, x))
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ typedef enum {
|
||||||
SMALL_SCREEN_FALSE
|
SMALL_SCREEN_FALSE
|
||||||
} CcSmallScreen;
|
} CcSmallScreen;
|
||||||
|
|
||||||
struct _GnomeControlCenterPrivate
|
struct _CcWindowPrivate
|
||||||
{
|
{
|
||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
GtkWidget *notebook;
|
GtkWidget *notebook;
|
||||||
|
@ -113,7 +113,7 @@ notebook_get_selected_page (GtkWidget *notebook)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
notebook_select_page (GtkWidget *notebook,
|
notebook_select_page (GtkWidget *notebook,
|
||||||
GtkWidget *page)
|
GtkWidget *page)
|
||||||
{
|
{
|
||||||
int i, num;
|
int i, num;
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ notebook_select_page (GtkWidget *notebook,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
notebook_remove_page (GtkWidget *notebook,
|
notebook_remove_page (GtkWidget *notebook,
|
||||||
GtkWidget *page)
|
GtkWidget *page)
|
||||||
{
|
{
|
||||||
int i, num;
|
int i, num;
|
||||||
|
|
||||||
|
@ -179,13 +179,13 @@ get_icon_name_from_g_icon (GIcon *gicon)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
activate_panel (GnomeControlCenter *self,
|
activate_panel (CcWindow *self,
|
||||||
const gchar *id,
|
const gchar *id,
|
||||||
const gchar **argv,
|
const gchar **argv,
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
GIcon *gicon)
|
GIcon *gicon)
|
||||||
{
|
{
|
||||||
GnomeControlCenterPrivate *priv = self->priv;
|
CcWindowPrivate *priv = self->priv;
|
||||||
GtkWidget *box;
|
GtkWidget *box;
|
||||||
const gchar *icon_name;
|
const gchar *icon_name;
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ activate_panel (GnomeControlCenter *self,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_shell_remove_all_custom_widgets (GnomeControlCenterPrivate *priv)
|
_shell_remove_all_custom_widgets (CcWindowPrivate *priv)
|
||||||
{
|
{
|
||||||
GtkBox *box;
|
GtkBox *box;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
@ -241,9 +241,9 @@ _shell_remove_all_custom_widgets (GnomeControlCenterPrivate *priv)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
shell_show_overview_page (GnomeControlCenter *self)
|
shell_show_overview_page (CcWindow *self)
|
||||||
{
|
{
|
||||||
GnomeControlCenterPrivate *priv = self->priv;
|
CcWindowPrivate *priv = self->priv;
|
||||||
|
|
||||||
notebook_select_page (priv->notebook, priv->scrolled_window);
|
notebook_select_page (priv->notebook, priv->scrolled_window);
|
||||||
|
|
||||||
|
@ -274,14 +274,14 @@ shell_show_overview_page (GnomeControlCenter *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gnome_control_center_set_overview_page (GnomeControlCenter *center)
|
cc_window_set_overview_page (CcWindow *center)
|
||||||
{
|
{
|
||||||
shell_show_overview_page (center);
|
shell_show_overview_page (center);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gnome_control_center_set_search_item (GnomeControlCenter *center,
|
cc_window_set_search_item (CcWindow *center,
|
||||||
const char *search)
|
const char *search)
|
||||||
{
|
{
|
||||||
shell_show_overview_page (center);
|
shell_show_overview_page (center);
|
||||||
gtk_entry_set_text (GTK_ENTRY (center->priv->search_entry), search);
|
gtk_entry_set_text (GTK_ENTRY (center->priv->search_entry), search);
|
||||||
|
@ -292,15 +292,15 @@ static void
|
||||||
item_activated_cb (CcShellCategoryView *view,
|
item_activated_cb (CcShellCategoryView *view,
|
||||||
gchar *name,
|
gchar *name,
|
||||||
gchar *id,
|
gchar *id,
|
||||||
GnomeControlCenter *shell)
|
CcWindow *shell)
|
||||||
{
|
{
|
||||||
cc_shell_set_active_panel_from_id (CC_SHELL (shell), id, NULL, NULL);
|
cc_shell_set_active_panel_from_id (CC_SHELL (shell), id, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
category_focus_out (GtkWidget *view,
|
category_focus_out (GtkWidget *view,
|
||||||
GdkEventFocus *event,
|
GdkEventFocus *event,
|
||||||
GnomeControlCenter *shell)
|
CcWindow *shell)
|
||||||
{
|
{
|
||||||
gtk_icon_view_unselect_all (GTK_ICON_VIEW (view));
|
gtk_icon_view_unselect_all (GTK_ICON_VIEW (view));
|
||||||
|
|
||||||
|
@ -308,9 +308,9 @@ category_focus_out (GtkWidget *view,
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
category_focus_in (GtkWidget *view,
|
category_focus_in (GtkWidget *view,
|
||||||
GdkEventFocus *event,
|
GdkEventFocus *event,
|
||||||
GnomeControlCenter *shell)
|
CcWindow *shell)
|
||||||
{
|
{
|
||||||
GtkTreePath *path;
|
GtkTreePath *path;
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ category_focus_in (GtkWidget *view,
|
||||||
}
|
}
|
||||||
|
|
||||||
static GList *
|
static GList *
|
||||||
get_item_views (GnomeControlCenter *shell)
|
get_item_views (CcWindow *shell)
|
||||||
{
|
{
|
||||||
GList *list, *l;
|
GList *list, *l;
|
||||||
GList *res;
|
GList *res;
|
||||||
|
@ -409,9 +409,9 @@ get_last_path (GtkIconView *view)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
categories_keynav_failed (GtkIconView *current_view,
|
categories_keynav_failed (GtkIconView *current_view,
|
||||||
GtkDirectionType direction,
|
GtkDirectionType direction,
|
||||||
GnomeControlCenter *shell)
|
CcWindow *shell)
|
||||||
{
|
{
|
||||||
GList *views, *v;
|
GList *views, *v;
|
||||||
GtkIconView *new_view;
|
GtkIconView *new_view;
|
||||||
|
@ -578,9 +578,9 @@ out:
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
model_filter_func (GtkTreeModel *model,
|
model_filter_func (GtkTreeModel *model,
|
||||||
GtkTreeIter *iter,
|
GtkTreeIter *iter,
|
||||||
GnomeControlCenterPrivate *priv)
|
CcWindowPrivate *priv)
|
||||||
{
|
{
|
||||||
if (!priv->filter_string)
|
if (!priv->filter_string)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -603,10 +603,10 @@ category_filter_func (GtkTreeModel *model,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
search_entry_changed_cb (GtkEntry *entry,
|
search_entry_changed_cb (GtkEntry *entry,
|
||||||
GnomeControlCenter *center)
|
CcWindow *center)
|
||||||
{
|
{
|
||||||
GnomeControlCenterPrivate *priv = center->priv;
|
CcWindowPrivate *priv = center->priv;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
/* if the entry text was set manually (not by the user) */
|
/* if the entry text was set manually (not by the user) */
|
||||||
|
@ -637,9 +637,9 @@ search_entry_changed_cb (GtkEntry *entry,
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
search_entry_key_press_event_cb (GtkEntry *entry,
|
search_entry_key_press_event_cb (GtkEntry *entry,
|
||||||
GdkEventKey *event,
|
GdkEventKey *event,
|
||||||
GnomeControlCenterPrivate *priv)
|
CcWindowPrivate *priv)
|
||||||
{
|
{
|
||||||
if (event->keyval == GDK_KEY_Return)
|
if (event->keyval == GDK_KEY_Return)
|
||||||
{
|
{
|
||||||
|
@ -676,7 +676,7 @@ static void
|
||||||
on_search_row_activated (GtkTreeView *treeview,
|
on_search_row_activated (GtkTreeView *treeview,
|
||||||
GtkTreePath *path,
|
GtkTreePath *path,
|
||||||
GtkTreeViewColumn *column,
|
GtkTreeViewColumn *column,
|
||||||
GnomeControlCenter *shell)
|
CcWindow *shell)
|
||||||
{
|
{
|
||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
|
@ -701,9 +701,9 @@ on_search_row_activated (GtkTreeView *treeview,
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
on_search_button_press_event (GtkTreeView *treeview,
|
on_search_button_press_event (GtkTreeView *treeview,
|
||||||
GdkEventButton *event,
|
GdkEventButton *event,
|
||||||
GnomeControlCenter *shell)
|
CcWindow *shell)
|
||||||
{
|
{
|
||||||
if (event->type == GDK_BUTTON_PRESS && event->button == 1)
|
if (event->type == GDK_BUTTON_PRESS && event->button == 1)
|
||||||
{
|
{
|
||||||
|
@ -744,12 +744,12 @@ on_search_button_press_event (GtkTreeView *treeview,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup_search (GnomeControlCenter *shell)
|
setup_search (CcWindow *shell)
|
||||||
{
|
{
|
||||||
GtkWidget *search_view, *widget;
|
GtkWidget *search_view, *widget;
|
||||||
GtkCellRenderer *renderer;
|
GtkCellRenderer *renderer;
|
||||||
GtkTreeViewColumn *column;
|
GtkTreeViewColumn *column;
|
||||||
GnomeControlCenterPrivate *priv = shell->priv;
|
CcWindowPrivate *priv = shell->priv;
|
||||||
|
|
||||||
g_return_if_fail (priv->store != NULL);
|
g_return_if_fail (priv->store != NULL);
|
||||||
|
|
||||||
|
@ -823,17 +823,17 @@ setup_search (GnomeControlCenter *shell)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup_lock (GnomeControlCenter *shell)
|
setup_lock (CcWindow *shell)
|
||||||
{
|
{
|
||||||
GnomeControlCenterPrivate *priv = shell->priv;
|
CcWindowPrivate *priv = shell->priv;
|
||||||
|
|
||||||
priv->lock_button = W (priv->builder, "lock-button");
|
priv->lock_button = W (priv->builder, "lock-button");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_category_view (GnomeControlCenter *shell,
|
add_category_view (CcWindow *shell,
|
||||||
CcPanelCategory category,
|
CcPanelCategory category,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
GtkTreeModel *filter;
|
GtkTreeModel *filter;
|
||||||
GtkWidget *categoryview;
|
GtkWidget *categoryview;
|
||||||
|
@ -876,9 +876,9 @@ add_category_view (GnomeControlCenter *shell,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup_model (GnomeControlCenter *shell)
|
setup_model (CcWindow *shell)
|
||||||
{
|
{
|
||||||
GnomeControlCenterPrivate *priv = shell->priv;
|
CcWindowPrivate *priv = shell->priv;
|
||||||
|
|
||||||
gtk_widget_set_margin_top (shell->priv->main_vbox, 8);
|
gtk_widget_set_margin_top (shell->priv->main_vbox, 8);
|
||||||
gtk_widget_set_margin_bottom (shell->priv->main_vbox, 8);
|
gtk_widget_set_margin_bottom (shell->priv->main_vbox, 8);
|
||||||
|
@ -899,17 +899,17 @@ setup_model (GnomeControlCenter *shell)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
home_button_clicked_cb (GtkButton *button,
|
home_button_clicked_cb (GtkButton *button,
|
||||||
GnomeControlCenter *shell)
|
CcWindow *shell)
|
||||||
{
|
{
|
||||||
shell_show_overview_page (shell);
|
shell_show_overview_page (shell);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
notebook_page_notify_cb (GtkNotebook *notebook,
|
notebook_page_notify_cb (GtkNotebook *notebook,
|
||||||
GParamSpec *spec,
|
GParamSpec *spec,
|
||||||
GnomeControlCenter *self)
|
CcWindow *self)
|
||||||
{
|
{
|
||||||
GnomeControlCenterPrivate *priv = self->priv;
|
CcWindowPrivate *priv = self->priv;
|
||||||
int nat_height;
|
int nat_height;
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
|
|
||||||
|
@ -948,7 +948,7 @@ static void
|
||||||
_shell_embed_widget_in_header (CcShell *shell,
|
_shell_embed_widget_in_header (CcShell *shell,
|
||||||
GtkWidget *widget)
|
GtkWidget *widget)
|
||||||
{
|
{
|
||||||
GnomeControlCenterPrivate *priv = GNOME_CONTROL_CENTER (shell)->priv;
|
CcWindowPrivate *priv = CC_WINDOW (shell)->priv;
|
||||||
GtkBox *box;
|
GtkBox *box;
|
||||||
|
|
||||||
/* add to header */
|
/* add to header */
|
||||||
|
@ -961,14 +961,14 @@ _shell_embed_widget_in_header (CcShell *shell,
|
||||||
static gboolean
|
static gboolean
|
||||||
_shell_set_active_panel_from_id (CcShell *shell,
|
_shell_set_active_panel_from_id (CcShell *shell,
|
||||||
const gchar *start_id,
|
const gchar *start_id,
|
||||||
const gchar **argv,
|
const gchar **argv,
|
||||||
GError **err)
|
GError **err)
|
||||||
{
|
{
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
gboolean iter_valid;
|
gboolean iter_valid;
|
||||||
gchar *name = NULL;
|
gchar *name = NULL;
|
||||||
GIcon *gicon = NULL;
|
GIcon *gicon = NULL;
|
||||||
GnomeControlCenterPrivate *priv = GNOME_CONTROL_CENTER (shell)->priv;
|
CcWindowPrivate *priv = CC_WINDOW (shell)->priv;
|
||||||
GtkWidget *old_panel;
|
GtkWidget *old_panel;
|
||||||
|
|
||||||
/* When loading the same panel again, just set the argv */
|
/* When loading the same panel again, just set the argv */
|
||||||
|
@ -1004,8 +1004,8 @@ _shell_set_active_panel_from_id (CcShell *shell,
|
||||||
{
|
{
|
||||||
g_free (id);
|
g_free (id);
|
||||||
g_free (name);
|
g_free (name);
|
||||||
if (gicon)
|
if (gicon)
|
||||||
g_object_unref (gicon);
|
g_object_unref (gicon);
|
||||||
|
|
||||||
name = NULL;
|
name = NULL;
|
||||||
id = NULL;
|
id = NULL;
|
||||||
|
@ -1022,7 +1022,7 @@ _shell_set_active_panel_from_id (CcShell *shell,
|
||||||
{
|
{
|
||||||
g_warning ("Could not find settings panel \"%s\"", start_id);
|
g_warning ("Could not find settings panel \"%s\"", start_id);
|
||||||
}
|
}
|
||||||
else if (activate_panel (GNOME_CONTROL_CENTER (shell), start_id, argv,
|
else if (activate_panel (CC_WINDOW (shell), start_id, argv,
|
||||||
name, gicon) == FALSE)
|
name, gicon) == FALSE)
|
||||||
{
|
{
|
||||||
/* Failed to activate the panel for some reason,
|
/* Failed to activate the panel for some reason,
|
||||||
|
@ -1053,12 +1053,12 @@ _shell_get_toplevel (CcShell *shell)
|
||||||
|
|
||||||
/* GObject Implementation */
|
/* GObject Implementation */
|
||||||
static void
|
static void
|
||||||
gnome_control_center_get_property (GObject *object,
|
cc_window_get_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GnomeControlCenterPrivate *priv = GNOME_CONTROL_CENTER (object)->priv;
|
CcWindowPrivate *priv = CC_WINDOW (object)->priv;
|
||||||
|
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
|
@ -1071,7 +1071,7 @@ gnome_control_center_get_property (GObject *object,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_active_panel (GnomeControlCenter *shell,
|
set_active_panel (CcWindow *shell,
|
||||||
CcPanel *panel)
|
CcPanel *panel)
|
||||||
{
|
{
|
||||||
g_return_if_fail (CC_IS_SHELL (shell));
|
g_return_if_fail (CC_IS_SHELL (shell));
|
||||||
|
@ -1092,12 +1092,12 @@ set_active_panel (GnomeControlCenter *shell,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnome_control_center_set_property (GObject *object,
|
cc_window_set_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GnomeControlCenter *shell = GNOME_CONTROL_CENTER (object);
|
CcWindow *shell = CC_WINDOW (object);
|
||||||
|
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
|
@ -1110,9 +1110,9 @@ gnome_control_center_set_property (GObject *object,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnome_control_center_dispose (GObject *object)
|
cc_window_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
GnomeControlCenterPrivate *priv = GNOME_CONTROL_CENTER (object)->priv;
|
CcWindowPrivate *priv = CC_WINDOW (object)->priv;
|
||||||
|
|
||||||
g_free (priv->current_panel_id);
|
g_free (priv->current_panel_id);
|
||||||
|
|
||||||
|
@ -1141,13 +1141,13 @@ gnome_control_center_dispose (GObject *object)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (gnome_control_center_parent_class)->dispose (object);
|
G_OBJECT_CLASS (cc_window_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnome_control_center_finalize (GObject *object)
|
cc_window_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
GnomeControlCenterPrivate *priv = GNOME_CONTROL_CENTER (object)->priv;
|
CcWindowPrivate *priv = CC_WINDOW (object)->priv;
|
||||||
|
|
||||||
if (priv->filter_string)
|
if (priv->filter_string)
|
||||||
{
|
{
|
||||||
|
@ -1155,7 +1155,7 @@ gnome_control_center_finalize (GObject *object)
|
||||||
priv->filter_string = NULL;
|
priv->filter_string = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS (gnome_control_center_parent_class)->finalize (object);
|
G_OBJECT_CLASS (cc_window_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1167,24 +1167,24 @@ cc_shell_iface_init (CcShellInterface *iface)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnome_control_center_class_init (GnomeControlCenterClass *klass)
|
cc_window_class_init (CcWindowClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GnomeControlCenterPrivate));
|
g_type_class_add_private (klass, sizeof (CcWindowPrivate));
|
||||||
|
|
||||||
object_class->get_property = gnome_control_center_get_property;
|
object_class->get_property = cc_window_get_property;
|
||||||
object_class->set_property = gnome_control_center_set_property;
|
object_class->set_property = cc_window_set_property;
|
||||||
object_class->dispose = gnome_control_center_dispose;
|
object_class->dispose = cc_window_dispose;
|
||||||
object_class->finalize = gnome_control_center_finalize;
|
object_class->finalize = cc_window_finalize;
|
||||||
|
|
||||||
g_object_class_override_property (object_class, PROP_ACTIVE_PANEL, "active-panel");
|
g_object_class_override_property (object_class, PROP_ACTIVE_PANEL, "active-panel");
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
window_key_press_event (GtkWidget *win,
|
window_key_press_event (GtkWidget *win,
|
||||||
GdkEventKey *event,
|
GdkEventKey *event,
|
||||||
GnomeControlCenter *self)
|
CcWindow *self)
|
||||||
{
|
{
|
||||||
GdkKeymap *keymap;
|
GdkKeymap *keymap;
|
||||||
gboolean retval;
|
gboolean retval;
|
||||||
|
@ -1237,7 +1237,7 @@ window_key_press_event (GtkWidget *win,
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
get_monitor_height (GnomeControlCenter *self)
|
get_monitor_height (CcWindow *self)
|
||||||
{
|
{
|
||||||
GdkScreen *screen;
|
GdkScreen *screen;
|
||||||
GdkRectangle rect;
|
GdkRectangle rect;
|
||||||
|
@ -1251,7 +1251,7 @@ get_monitor_height (GnomeControlCenter *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
update_monitor_number (GnomeControlCenter *self)
|
update_monitor_number (CcWindow *self)
|
||||||
{
|
{
|
||||||
gboolean changed = FALSE;
|
gboolean changed = FALSE;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
@ -1274,7 +1274,7 @@ update_monitor_number (GnomeControlCenter *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static CcSmallScreen
|
static CcSmallScreen
|
||||||
is_small (GnomeControlCenter *self)
|
is_small (CcWindow *self)
|
||||||
{
|
{
|
||||||
if (get_monitor_height (self) <= FIXED_HEIGHT)
|
if (get_monitor_height (self) <= FIXED_HEIGHT)
|
||||||
return SMALL_SCREEN_TRUE;
|
return SMALL_SCREEN_TRUE;
|
||||||
|
@ -1282,7 +1282,7 @@ is_small (GnomeControlCenter *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_small_screen_settings (GnomeControlCenter *self)
|
update_small_screen_settings (CcWindow *self)
|
||||||
{
|
{
|
||||||
CcSmallScreen small;
|
CcSmallScreen small;
|
||||||
|
|
||||||
|
@ -1313,7 +1313,7 @@ update_small_screen_settings (GnomeControlCenter *self)
|
||||||
static gboolean
|
static gboolean
|
||||||
main_window_configure_cb (GtkWidget *widget,
|
main_window_configure_cb (GtkWidget *widget,
|
||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
GnomeControlCenter *self)
|
CcWindow *self)
|
||||||
{
|
{
|
||||||
update_small_screen_settings (self);
|
update_small_screen_settings (self);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1322,7 +1322,7 @@ main_window_configure_cb (GtkWidget *widget,
|
||||||
static void
|
static void
|
||||||
application_set_cb (GObject *object,
|
application_set_cb (GObject *object,
|
||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
GnomeControlCenter *self)
|
CcWindow *self)
|
||||||
{
|
{
|
||||||
/* update small screen settings now - to avoid visible resizing, we want
|
/* update small screen settings now - to avoid visible resizing, we want
|
||||||
* to do it before showing the window, and GtkApplicationWindow cannot be
|
* to do it before showing the window, and GtkApplicationWindow cannot be
|
||||||
|
@ -1336,7 +1336,7 @@ application_set_cb (GObject *object,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
monitors_changed_cb (GdkScreen *screen,
|
monitors_changed_cb (GdkScreen *screen,
|
||||||
GnomeControlCenter *self)
|
CcWindow *self)
|
||||||
{
|
{
|
||||||
/* We reset small_screen_set to make sure that the
|
/* We reset small_screen_set to make sure that the
|
||||||
* window gets maximised if need be, in update_small_screen_settings() */
|
* window gets maximised if need be, in update_small_screen_settings() */
|
||||||
|
@ -1347,7 +1347,7 @@ monitors_changed_cb (GdkScreen *screen,
|
||||||
static void
|
static void
|
||||||
gdk_window_set_cb (GObject *object,
|
gdk_window_set_cb (GObject *object,
|
||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
GnomeControlCenter *self)
|
CcWindow *self)
|
||||||
{
|
{
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
gchar *str;
|
gchar *str;
|
||||||
|
@ -1366,15 +1366,15 @@ gdk_window_set_cb (GObject *object,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnome_control_center_init (GnomeControlCenter *self)
|
cc_window_init (CcWindow *self)
|
||||||
{
|
{
|
||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
GnomeControlCenterPrivate *priv;
|
CcWindowPrivate *priv;
|
||||||
GdkScreen *screen;
|
GdkScreen *screen;
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
GtkWidget *box;
|
GtkWidget *box;
|
||||||
|
|
||||||
priv = self->priv = CONTROL_CENTER_PRIVATE (self);
|
priv = self->priv = WINDOW_PRIVATE (self);
|
||||||
|
|
||||||
priv->monitor_num = -1;
|
priv->monitor_num = -1;
|
||||||
self->priv->small_screen = SMALL_SCREEN_UNSET;
|
self->priv->small_screen = SMALL_SCREEN_UNSET;
|
||||||
|
@ -1435,12 +1435,12 @@ gnome_control_center_init (GnomeControlCenter *self)
|
||||||
notebook_page_notify_cb (GTK_NOTEBOOK (priv->notebook), NULL, self);
|
notebook_page_notify_cb (GTK_NOTEBOOK (priv->notebook), NULL, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
GnomeControlCenter *
|
CcWindow *
|
||||||
gnome_control_center_new (GtkApplication *application)
|
cc_window_new (GtkApplication *application)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_APPLICATION (application), NULL);
|
g_return_val_if_fail (GTK_IS_APPLICATION (application), NULL);
|
||||||
|
|
||||||
return g_object_new (GNOME_TYPE_CONTROL_CENTER,
|
return g_object_new (CC_TYPE_WINDOW,
|
||||||
"application", application,
|
"application", application,
|
||||||
"hide-titlebar-when-maximized", TRUE,
|
"hide-titlebar-when-maximized", TRUE,
|
||||||
"resizable", TRUE,
|
"resizable", TRUE,
|
||||||
|
@ -1451,13 +1451,13 @@ gnome_control_center_new (GtkApplication *application)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gnome_control_center_present (GnomeControlCenter *center)
|
cc_window_present (CcWindow *center)
|
||||||
{
|
{
|
||||||
gtk_window_present (GTK_WINDOW (center));
|
gtk_window_present (GTK_WINDOW (center));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gnome_control_center_show (GnomeControlCenter *center)
|
cc_window_show (CcWindow *center)
|
||||||
{
|
{
|
||||||
gtk_widget_show (GTK_WIDGET (center));
|
gtk_widget_show (GTK_WIDGET (center));
|
||||||
}
|
}
|
66
shell/cc-window.h
Normal file
66
shell/cc-window.h
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010 Intel, Inc.
|
||||||
|
*
|
||||||
|
* The Control Center 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 2 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* The Control Center 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.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with the Control Center; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Author: Thomas Wood <thos@gnome.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _CC_WINDOW_H
|
||||||
|
#define _CC_WINDOW_H
|
||||||
|
|
||||||
|
#include <glib-object.h>
|
||||||
|
#include "cc-shell.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define CC_TYPE_WINDOW cc_window_get_type()
|
||||||
|
#define CC_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_TYPE_WINDOW, CcWindow))
|
||||||
|
#define CC_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CC_TYPE_WINDOW, CcWindowClass))
|
||||||
|
#define CC_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CC_TYPE_WINDOW))
|
||||||
|
#define CC_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_TYPE_WINDOW))
|
||||||
|
#define CC_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_TYPE_WINDOW, CcWindowClass))
|
||||||
|
|
||||||
|
typedef struct _CcWindow CcWindow;
|
||||||
|
typedef struct _CcWindowClass CcWindowClass;
|
||||||
|
typedef struct _CcWindowPrivate CcWindowPrivate;
|
||||||
|
|
||||||
|
struct _CcWindow
|
||||||
|
{
|
||||||
|
GtkApplicationWindow parent;
|
||||||
|
CcWindowPrivate *priv;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _CcWindowClass
|
||||||
|
{
|
||||||
|
GtkApplicationWindowClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
GType cc_window_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
CcWindow *cc_window_new (GtkApplication *application);
|
||||||
|
|
||||||
|
void cc_window_present (CcWindow *center);
|
||||||
|
|
||||||
|
void cc_window_show (CcWindow *center);
|
||||||
|
|
||||||
|
void cc_window_set_overview_page (CcWindow *center);
|
||||||
|
|
||||||
|
void cc_window_set_search_item (CcWindow *center,
|
||||||
|
const char *search);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* _CC_WINDOW_H */
|
|
@ -1,81 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2010 Intel, Inc.
|
|
||||||
*
|
|
||||||
* The Control Center 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 2 of the License, or (at your
|
|
||||||
* option) any later version.
|
|
||||||
*
|
|
||||||
* The Control Center 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.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with the Control Center; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*
|
|
||||||
* Author: Thomas Wood <thos@gnome.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _GNOME_CONTROL_CENTER_H
|
|
||||||
#define _GNOME_CONTROL_CENTER_H
|
|
||||||
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include "cc-shell.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define GNOME_TYPE_CONTROL_CENTER gnome_control_center_get_type()
|
|
||||||
|
|
||||||
#define GNOME_CONTROL_CENTER(obj) \
|
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
|
|
||||||
GNOME_TYPE_CONTROL_CENTER, GnomeControlCenter))
|
|
||||||
|
|
||||||
#define GNOME_CONTROL_CENTER_CLASS(klass) \
|
|
||||||
(G_TYPE_CHECK_CLASS_CAST ((klass), \
|
|
||||||
GNOME_TYPE_CONTROL_CENTER, GnomeControlCenterClass))
|
|
||||||
|
|
||||||
#define GNOME_IS_CONTROL_CENTER(obj) \
|
|
||||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
|
|
||||||
GNOME_TYPE_CONTROL_CENTER))
|
|
||||||
|
|
||||||
#define GNOME_IS_CONTROL_CENTER_CLASS(klass) \
|
|
||||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
|
|
||||||
GNOME_TYPE_CONTROL_CENTER))
|
|
||||||
|
|
||||||
#define GNOME_CONTROL_CENTER_GET_CLASS(obj) \
|
|
||||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
|
|
||||||
GNOME_TYPE_CONTROL_CENTER, GnomeControlCenterClass))
|
|
||||||
|
|
||||||
typedef struct _GnomeControlCenter GnomeControlCenter;
|
|
||||||
typedef struct _GnomeControlCenterClass GnomeControlCenterClass;
|
|
||||||
typedef struct _GnomeControlCenterPrivate GnomeControlCenterPrivate;
|
|
||||||
|
|
||||||
struct _GnomeControlCenter
|
|
||||||
{
|
|
||||||
GtkApplicationWindow parent;
|
|
||||||
GnomeControlCenterPrivate *priv;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GnomeControlCenterClass
|
|
||||||
{
|
|
||||||
GtkApplicationWindowClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
GType gnome_control_center_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
GnomeControlCenter *gnome_control_center_new (GtkApplication *application);
|
|
||||||
|
|
||||||
void gnome_control_center_present (GnomeControlCenter *center);
|
|
||||||
|
|
||||||
void gnome_control_center_show (GnomeControlCenter *center);
|
|
||||||
|
|
||||||
void gnome_control_center_set_overview_page (GnomeControlCenter *center);
|
|
||||||
|
|
||||||
void gnome_control_center_set_search_item (GnomeControlCenter *center,
|
|
||||||
const char *search);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* _GNOME_CONTROL_CENTER_H */
|
|
Loading…
Add table
Add a link
Reference in a new issue