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
@@ -232,3 +232,7 @@ GcalEventWidget.color-light:backdrop {
|
|||||||
.details-frame {
|
.details-frame {
|
||||||
background-color: rgba(0, 0, 0, 0);
|
background-color: rgba(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.spinner-offscreen {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|||||||
@@ -428,4 +428,17 @@
|
|||||||
<class name="details-frame"/>
|
<class name="details-frame"/>
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="GtkOffscreenWindow" id="spinner_window">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<signal name="damage-event" handler="spinner_damaged" object="GcalSourceDialog" swapped="no"/>
|
||||||
|
<style>
|
||||||
|
<class name="spinner-offscreen" />
|
||||||
|
</style>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSpinner" id="spinner">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
</interface>
|
</interface>
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ typedef struct
|
|||||||
GtkWidget *headerbar;
|
GtkWidget *headerbar;
|
||||||
GtkWidget *name_entry;
|
GtkWidget *name_entry;
|
||||||
GtkWidget *notebook;
|
GtkWidget *notebook;
|
||||||
|
GtkWidget *spinner;
|
||||||
|
GtkWidget *spinner_window;
|
||||||
GtkWidget *remove_button;
|
GtkWidget *remove_button;
|
||||||
GtkWidget *select_file_button;
|
GtkWidget *select_file_button;
|
||||||
GtkWidget *stack;
|
GtkWidget *stack;
|
||||||
@@ -102,6 +104,10 @@ static void select_calendar_file (GtkButton *bu
|
|||||||
static void setup_source_details (GcalSourceDialog *dialog,
|
static void setup_source_details (GcalSourceDialog *dialog,
|
||||||
ESource *source);
|
ESource *source);
|
||||||
|
|
||||||
|
static gboolean spinner_damaged (GtkWidget *spinner,
|
||||||
|
GdkEvent *event,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
static void url_entry_text_changed (GObject *object,
|
static void url_entry_text_changed (GObject *object,
|
||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
@@ -467,6 +473,29 @@ setup_source_details (GcalSourceDialog *dialog,
|
|||||||
gtk_widget_show_all (priv->details_frame);
|
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:
|
* url_entry_text_changed:
|
||||||
*
|
*
|
||||||
@@ -496,6 +525,7 @@ url_entry_text_changed (GObject *object,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* remove entry's icon */
|
/* 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);
|
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;
|
priv->validate_url_resource_id = 0;
|
||||||
|
|
||||||
|
gtk_spinner_start (GTK_SPINNER (priv->spinner));
|
||||||
|
|
||||||
g_message ("stub");
|
g_message ("stub");
|
||||||
|
|
||||||
return FALSE;
|
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, notebook);
|
||||||
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, remove_button);
|
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, 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, stack);
|
||||||
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, web_source_grid);
|
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, notebook_page_switched);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, response_signal);
|
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, 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);
|
gtk_widget_class_bind_template_callback (widget_class, url_entry_text_changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user