source-dialog: show a spinner when it should be validating
This commit is contained in:
committed by
Erick Pérez Castellanos
parent
54e6bca518
commit
b59da7e2e0
@@ -33,6 +33,8 @@ typedef struct
|
||||
GtkWidget *headerbar;
|
||||
GtkWidget *name_entry;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *spinner;
|
||||
GtkWidget *spinner_window;
|
||||
GtkWidget *remove_button;
|
||||
GtkWidget *select_file_button;
|
||||
GtkWidget *stack;
|
||||
@@ -102,6 +104,10 @@ static void select_calendar_file (GtkButton *bu
|
||||
static void setup_source_details (GcalSourceDialog *dialog,
|
||||
ESource *source);
|
||||
|
||||
static gboolean spinner_damaged (GtkWidget *spinner,
|
||||
GdkEvent *event,
|
||||
gpointer user_data);
|
||||
|
||||
static void url_entry_text_changed (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data);
|
||||
@@ -467,6 +473,29 @@ setup_source_details (GcalSourceDialog *dialog,
|
||||
gtk_widget_show_all (priv->details_frame);
|
||||
}
|
||||
|
||||
/**
|
||||
* spinner_damaged:
|
||||
*
|
||||
* Update the url's entry with
|
||||
* the spinner icon.
|
||||
*
|
||||
* Returns: FALSE
|
||||
*/
|
||||
static gboolean
|
||||
spinner_damaged (GtkWidget *spinner,
|
||||
GdkEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
GcalSourceDialogPrivate *priv = GCAL_SOURCE_DIALOG (user_data)->priv;
|
||||
GdkPixbuf *pix;
|
||||
|
||||
pix = gtk_offscreen_window_get_pixbuf (GTK_OFFSCREEN_WINDOW (priv->spinner_window));
|
||||
|
||||
gtk_entry_set_icon_from_pixbuf (GTK_ENTRY (priv->calendar_address_entry), GTK_ENTRY_ICON_SECONDARY, pix);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* url_entry_text_changed:
|
||||
*
|
||||
@@ -496,6 +525,7 @@ url_entry_text_changed (GObject *object,
|
||||
else
|
||||
{
|
||||
/* remove entry's icon */
|
||||
gtk_spinner_stop (GTK_SPINNER (priv->spinner));
|
||||
gtk_entry_set_icon_from_pixbuf (GTK_ENTRY (priv->calendar_address_entry), GTK_ENTRY_ICON_SECONDARY, NULL);
|
||||
}
|
||||
}
|
||||
@@ -515,6 +545,8 @@ validate_url_cb (GcalSourceDialog *dialog)
|
||||
|
||||
priv->validate_url_resource_id = 0;
|
||||
|
||||
gtk_spinner_start (GTK_SPINNER (priv->spinner));
|
||||
|
||||
g_message ("stub");
|
||||
|
||||
return FALSE;
|
||||
@@ -615,6 +647,8 @@ gcal_source_dialog_class_init (GcalSourceDialogClass *klass)
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, notebook);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, remove_button);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, select_file_button);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, spinner);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, spinner_window);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, stack);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, web_source_grid);
|
||||
|
||||
@@ -626,6 +660,7 @@ gcal_source_dialog_class_init (GcalSourceDialogClass *klass)
|
||||
gtk_widget_class_bind_template_callback (widget_class, notebook_page_switched);
|
||||
gtk_widget_class_bind_template_callback (widget_class, response_signal);
|
||||
gtk_widget_class_bind_template_callback (widget_class, select_calendar_file);
|
||||
gtk_widget_class_bind_template_callback (widget_class, spinner_damaged);
|
||||
gtk_widget_class_bind_template_callback (widget_class, url_entry_text_changed);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user