[gnome-control-center] online-accounts: Use GTK widget types
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] online-accounts: Use GTK widget types
- Date: Mon, 30 Mar 2020 02:17:23 +0000 (UTC)
commit 97ac89b88f0e59d96697210d6130853b87dd8141
Author: Robert Ancell <robert ancell canonical com>
Date: Wed Nov 20 15:00:36 2019 +1300
online-accounts: Use GTK widget types
panels/online-accounts/cc-online-accounts-panel.c | 92 +++++++++++------------
1 file changed, 46 insertions(+), 46 deletions(-)
---
diff --git a/panels/online-accounts/cc-online-accounts-panel.c
b/panels/online-accounts/cc-online-accounts-panel.c
index 0da41a7e6..1d6d545dc 100644
--- a/panels/online-accounts/cc-online-accounts-panel.c
+++ b/panels/online-accounts/cc-online-accounts-panel.c
@@ -38,24 +38,24 @@ struct _CcGoaPanel
{
CcPanel parent_instance;
+ GtkFrame *accounts_frame;
+ GtkListBox *accounts_listbox;
+ GtkDialog *edit_account_dialog;
+ GtkHeaderBar *edit_account_headerbar;
+ GtkListBoxRow *more_providers_row;
+ GtkBox *new_account_vbox;
+ GtkLabel *notification_label;
+ GtkRevealer *notification_revealer;
+ GtkLabel *offline_label;
+ GtkListBox *providers_listbox;
+ GtkButton *remove_account_button;
+ GtkStack *stack;
+ GtkBox *accounts_vbox;
+
GoaClient *client;
GoaObject *active_object;
GoaObject *removed_object;
- GtkWidget *accounts_frame;
- GtkWidget *accounts_listbox;
- GtkWidget *edit_account_dialog;
- GtkWidget *edit_account_headerbar;
- GtkWidget *more_providers_row;
- GtkWidget *new_account_vbox;
- GtkWidget *notification_label;
- GtkWidget *notification_revealer;
- GtkWidget *offline_label;
- GtkWidget *providers_listbox;
- GtkWidget *remove_account_button;
- GtkWidget *stack;
- GtkWidget *accounts_vbox;
-
gboolean destroyed;
guint remove_account_timeout_id;
};
@@ -109,9 +109,9 @@ enum {
static void
reset_headerbar (CcGoaPanel *self)
{
- gtk_header_bar_set_title (GTK_HEADER_BAR (self->edit_account_headerbar), NULL);
- gtk_header_bar_set_subtitle (GTK_HEADER_BAR (self->edit_account_headerbar), NULL);
- gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (self->edit_account_headerbar), TRUE);
+ gtk_header_bar_set_title (self->edit_account_headerbar, NULL);
+ gtk_header_bar_set_subtitle (self->edit_account_headerbar, NULL);
+ gtk_header_bar_set_show_close_button (self->edit_account_headerbar, TRUE);
/* Remove any leftover widgets */
gtk_container_foreach (GTK_CONTAINER (self->edit_account_headerbar),
@@ -194,9 +194,9 @@ sort_providers_func (GtkListBoxRow *a,
self = user_data;
- if (a == GTK_LIST_BOX_ROW (self->more_providers_row))
+ if (a == self->more_providers_row)
return 1;
- else if (b == GTK_LIST_BOX_ROW (self->more_providers_row))
+ else if (b == self->more_providers_row)
return -1;
a_provider = g_object_get_data (G_OBJECT (a), "goa-provider");
@@ -234,7 +234,7 @@ show_non_branded_providers (CcGoaPanel *self)
gtk_widget_show (l->data);
}
- gtk_widget_hide (self->more_providers_row);
+ gtk_widget_hide (GTK_WIDGET (self->more_providers_row));
g_list_free (children);
}
@@ -255,7 +255,7 @@ add_account (CcGoaPanel *self,
reset_headerbar (self);
/* Move to the new account page */
- gtk_stack_set_visible_child_name (GTK_STACK (self->stack), "new-account");
+ gtk_stack_set_visible_child_name (self->stack, "new-account");
/* Reset the dialog size */
gtk_window_resize (GTK_WINDOW (self->edit_account_dialog), 1, 1);
@@ -263,12 +263,12 @@ add_account (CcGoaPanel *self,
/* This spins gtk_dialog_run() */
object = goa_provider_add_account (provider,
self->client,
- GTK_DIALOG (self->edit_account_dialog),
- GTK_BOX (self->new_account_vbox),
+ self->edit_account_dialog,
+ self->new_account_vbox,
&error);
if (object == NULL)
- gtk_widget_hide (self->edit_account_dialog);
+ gtk_widget_hide (GTK_WIDGET (self->edit_account_dialog));
else
show_page_account (self, object);
}
@@ -280,7 +280,7 @@ on_provider_row_activated (CcGoaPanel *self,
GoaProvider *provider;
/* Show More row */
- if (activated_row == GTK_LIST_BOX_ROW (self->more_providers_row))
+ if (activated_row == self->more_providers_row)
{
show_non_branded_providers (self);
return;
@@ -399,7 +399,7 @@ cc_goa_panel_dispose (GObject *object)
CcGoaPanel *panel = CC_GOA_PANEL (object);
/* Must be destroyed in dispose, not finalize. */
- g_clear_pointer (&panel->edit_account_dialog, gtk_widget_destroy);
+ g_clear_pointer ((GtkWidget **) &panel->edit_account_dialog, gtk_widget_destroy);
panel->destroyed = TRUE;
@@ -442,20 +442,20 @@ cc_goa_panel_init (CcGoaPanel *panel)
gtk_widget_init_template (GTK_WIDGET (panel));
- gtk_list_box_set_header_func (GTK_LIST_BOX (panel->accounts_listbox),
+ gtk_list_box_set_header_func (panel->accounts_listbox,
cc_list_box_update_header_func,
NULL,
NULL);
- gtk_list_box_set_sort_func (GTK_LIST_BOX (panel->accounts_listbox),
+ gtk_list_box_set_sort_func (panel->accounts_listbox,
sort_func,
panel,
NULL);
- gtk_list_box_set_header_func (GTK_LIST_BOX (panel->providers_listbox),
+ gtk_list_box_set_header_func (panel->providers_listbox,
cc_list_box_update_header_func,
NULL,
NULL);
- gtk_list_box_set_sort_func (GTK_LIST_BOX (panel->providers_listbox),
+ gtk_list_box_set_sort_func (panel->providers_listbox,
sort_providers_func,
panel,
NULL);
@@ -590,7 +590,7 @@ show_page_account (CcGoaPanel *panel,
reset_headerbar (panel);
/* Move to the account editor page */
- gtk_stack_set_visible_child_name (GTK_STACK (panel->stack), "editor");
+ gtk_stack_set_visible_child_name (panel->stack, "editor");
/* Out with the old */
children = gtk_container_get_children (GTK_CONTAINER (panel->accounts_vbox));
@@ -601,7 +601,7 @@ show_page_account (CcGoaPanel *panel,
account = goa_object_peek_account (object);
is_locked = goa_account_get_is_locked (account);
- gtk_widget_set_visible (panel->remove_account_button, !is_locked);
+ gtk_widget_set_visible (GTK_WIDGET (panel->remove_account_button), !is_locked);
provider_type = goa_account_get_provider_type (account);
provider = goa_provider_get_for_provider_type (provider_type);
@@ -611,7 +611,7 @@ show_page_account (CcGoaPanel *panel,
goa_provider_show_account (provider,
panel->client,
object,
- GTK_BOX (panel->accounts_vbox),
+ panel->accounts_vbox,
NULL,
NULL);
/*
@@ -625,14 +625,14 @@ show_page_account (CcGoaPanel *panel,
/* translators: This is the title of the "Show Account" dialog. The
* %s is the name of the provider. e.g., 'Google'. */
title = g_strdup_printf (_("%s Account"), provider_name);
- gtk_header_bar_set_title (GTK_HEADER_BAR (panel->edit_account_headerbar), title);
+ gtk_header_bar_set_title (panel->edit_account_headerbar, title);
g_free (title);
/* Reset the dialog size */
gtk_window_resize (GTK_WINDOW (panel->edit_account_dialog), 1, 1);
- gtk_widget_show (panel->accounts_vbox);
- gtk_widget_show (panel->edit_account_dialog);
+ gtk_widget_show (GTK_WIDGET (panel->accounts_vbox));
+ gtk_widget_show (GTK_WIDGET (panel->edit_account_dialog));
g_clear_object (&provider);
}
@@ -669,7 +669,7 @@ static gboolean
on_edit_account_dialog_delete_event (CcGoaPanel *self)
{
self->active_object = NULL;
- gtk_widget_hide (self->edit_account_dialog);
+ gtk_widget_hide (GTK_WIDGET (self->edit_account_dialog));
return TRUE;
}
@@ -711,21 +711,21 @@ static void
hide_row_for_account (CcGoaPanel *self, GtkWidget *row, GList *other_rows)
{
gtk_widget_hide (row);
- gtk_widget_set_visible (self->accounts_frame, other_rows != NULL);
+ gtk_widget_set_visible (GTK_WIDGET (self->accounts_frame), other_rows != NULL);
}
static void
remove_row_for_account (CcGoaPanel *self, GtkWidget *row, GList *other_rows)
{
gtk_widget_destroy (row);
- gtk_widget_set_visible (self->accounts_frame, other_rows != NULL);
+ gtk_widget_set_visible (GTK_WIDGET (self->accounts_frame), other_rows != NULL);
}
static void
show_row_for_account (CcGoaPanel *self, GtkWidget *row, GList *other_rows)
{
gtk_widget_show (row);
- gtk_widget_show (self->accounts_frame);
+ gtk_widget_show (GTK_WIDGET (self->accounts_frame));
}
static void
@@ -834,7 +834,7 @@ on_account_added (GoaClient *client,
/* Add to the listbox */
gtk_container_add (GTK_CONTAINER (self->accounts_listbox), row);
- gtk_widget_show (self->accounts_frame);
+ gtk_widget_show (GTK_WIDGET (self->accounts_frame));
g_clear_pointer (&title, g_free);
g_clear_object (&gicon);
@@ -942,7 +942,7 @@ on_notification_closed (GtkButton *button,
(GAsyncReadyCallback) remove_account_cb,
g_object_ref (self));
- gtk_revealer_set_reveal_child (GTK_REVEALER (self->notification_revealer), FALSE);
+ gtk_revealer_set_reveal_child (self->notification_revealer, FALSE);
cancel_notification_timeout (self);
self->removed_object = NULL;
@@ -954,7 +954,7 @@ on_undo_button_clicked (GtkButton *button,
{
/* Simply show the account row and hide the notification */
modify_row_for_account (self, self->removed_object, show_row_for_account);
- gtk_revealer_set_reveal_child (GTK_REVEALER (self->notification_revealer), FALSE);
+ gtk_revealer_set_reveal_child (self->notification_revealer, FALSE);
cancel_notification_timeout (self);
self->removed_object = NULL;
@@ -989,11 +989,11 @@ on_remove_button_clicked (CcGoaPanel *panel)
* or rishi).
*/
label = g_strdup_printf (_("%s removed"), id);
- gtk_label_set_markup (GTK_LABEL (panel->notification_label), label);
- gtk_revealer_set_reveal_child (GTK_REVEALER (panel->notification_revealer), TRUE);
+ gtk_label_set_markup (panel->notification_label, label);
+ gtk_revealer_set_reveal_child (panel->notification_revealer, TRUE);
modify_row_for_account (panel, panel->removed_object, hide_row_for_account);
- gtk_widget_hide (panel->edit_account_dialog);
+ gtk_widget_hide (GTK_WIDGET (panel->edit_account_dialog));
panel->remove_account_timeout_id = g_timeout_add_seconds (10, on_remove_account_timeout, panel);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]