Updated Notification system to new UI
Still mising here some way to solve the stacked notifications issue.
This commit is contained in:
@@ -5,7 +5,6 @@ TODO
|
|||||||
- Remove GcalSearchbar
|
- Remove GcalSearchbar
|
||||||
- Add disable/enable of views
|
- Add disable/enable of views
|
||||||
- Update NewEvent widget to use GtkOverlay
|
- Update NewEvent widget to use GtkOverlay
|
||||||
- Update Notification widget to use GtkOverlay
|
|
||||||
- Clean GcalWindow compilation, no warnings
|
- Clean GcalWindow compilation, no warnings
|
||||||
- Remove Clutter dependecy
|
- Remove Clutter dependecy
|
||||||
|
|
||||||
|
|||||||
+16
-13
@@ -49,7 +49,9 @@ struct _GcalWindowPrivate
|
|||||||
GtkWidget *search_bar;
|
GtkWidget *search_bar;
|
||||||
GtkWidget *views_overlay;
|
GtkWidget *views_overlay;
|
||||||
GtkWidget *views_stack;
|
GtkWidget *views_stack;
|
||||||
|
GtkWidget *noty; /* short-lived */
|
||||||
|
|
||||||
|
/* header_bar widets */
|
||||||
GtkWidget *new_button;
|
GtkWidget *new_button;
|
||||||
GtkWidget *search_entry;
|
GtkWidget *search_entry;
|
||||||
GtkWidget *views_switcher;
|
GtkWidget *views_switcher;
|
||||||
@@ -911,6 +913,9 @@ gcal_window_remove_event (GdNotification *notification,
|
|||||||
g_free (priv->event_to_delete);
|
g_free (priv->event_to_delete);
|
||||||
priv->event_to_delete = NULL;
|
priv->event_to_delete = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* since this is called when the notification is dismissed is safe to do here: */
|
||||||
|
priv->noty = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1099,7 +1104,6 @@ gcal_window_edit_dialog_responded (GtkDialog *dialog,
|
|||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
GtkWidget *event_widget;
|
GtkWidget *event_widget;
|
||||||
GtkWidget *noty;
|
|
||||||
GtkWidget *grid;
|
GtkWidget *grid;
|
||||||
GtkWidget *undo_button;
|
GtkWidget *undo_button;
|
||||||
|
|
||||||
@@ -1203,7 +1207,10 @@ gcal_window_edit_dialog_responded (GtkDialog *dialog,
|
|||||||
break;
|
break;
|
||||||
case GCAL_RESPONSE_DELETE_EVENT:
|
case GCAL_RESPONSE_DELETE_EVENT:
|
||||||
/* delete the event */
|
/* delete the event */
|
||||||
noty = gd_notification_new ();
|
if (priv->noty != NULL)
|
||||||
|
g_clear_object (&(priv->noty));
|
||||||
|
|
||||||
|
priv->noty = gd_notification_new ();
|
||||||
grid = gtk_grid_new ();
|
grid = gtk_grid_new ();
|
||||||
gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
|
||||||
gtk_container_add (GTK_CONTAINER (grid),
|
gtk_container_add (GTK_CONTAINER (grid),
|
||||||
@@ -1212,11 +1219,10 @@ gcal_window_edit_dialog_responded (GtkDialog *dialog,
|
|||||||
undo_button = gtk_button_new_from_stock (GTK_STOCK_UNDO);
|
undo_button = gtk_button_new_from_stock (GTK_STOCK_UNDO);
|
||||||
gtk_container_add (GTK_CONTAINER (grid), undo_button);
|
gtk_container_add (GTK_CONTAINER (grid), undo_button);
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (noty), grid);
|
gtk_container_add (GTK_CONTAINER (priv->noty), grid);
|
||||||
gtk_widget_show_all (noty);
|
gcal_window_show_notification (GCAL_WINDOW (user_data));
|
||||||
gcal_window_show_notification (GCAL_WINDOW (user_data), noty);
|
|
||||||
|
|
||||||
g_signal_connect (noty,
|
g_signal_connect (priv->noty,
|
||||||
"dismissed",
|
"dismissed",
|
||||||
G_CALLBACK (gcal_window_remove_event),
|
G_CALLBACK (gcal_window_remove_event),
|
||||||
user_data);
|
user_data);
|
||||||
@@ -1324,8 +1330,7 @@ gcal_window_new_with_view (GcalApplication *app,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gcal_window_show_notification (GcalWindow *window,
|
gcal_window_show_notification (GcalWindow *window)
|
||||||
GtkWidget *notification)
|
|
||||||
{
|
{
|
||||||
GcalWindowPrivate *priv;
|
GcalWindowPrivate *priv;
|
||||||
|
|
||||||
@@ -1333,19 +1338,17 @@ gcal_window_show_notification (GcalWindow *window,
|
|||||||
priv = window->priv;
|
priv = window->priv;
|
||||||
|
|
||||||
gtk_overlay_add_overlay (GTK_OVERLAY (priv->views_overlay),
|
gtk_overlay_add_overlay (GTK_OVERLAY (priv->views_overlay),
|
||||||
notification);
|
priv->noty);
|
||||||
gtk_widget_show_all (notification);
|
gtk_widget_show_all (priv->noty);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gcal_window_hide_notification (GcalWindow *window)
|
gcal_window_hide_notification (GcalWindow *window)
|
||||||
{
|
{
|
||||||
GcalWindowPrivate *priv;
|
GcalWindowPrivate *priv;
|
||||||
GtkWidget *noty;
|
|
||||||
|
|
||||||
g_return_if_fail (GCAL_IS_WINDOW (window));
|
g_return_if_fail (GCAL_IS_WINDOW (window));
|
||||||
priv = window->priv;
|
priv = window->priv;
|
||||||
|
|
||||||
/* FIXME: get notification widget somehow */
|
gd_notification_dismiss (GD_NOTIFICATION (priv->noty));
|
||||||
/* gd_notification_dismiss (GD_NOTIFICATION (noty)); */
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -57,8 +57,7 @@ GType gcal_window_get_type (void);
|
|||||||
GtkWidget* gcal_window_new_with_view (GcalApplication *app,
|
GtkWidget* gcal_window_new_with_view (GcalApplication *app,
|
||||||
GcalWindowViewType view_type);
|
GcalWindowViewType view_type);
|
||||||
|
|
||||||
void gcal_window_show_notification (GcalWindow *window,
|
void gcal_window_show_notification (GcalWindow *window);
|
||||||
GtkWidget *notification);
|
|
||||||
|
|
||||||
void gcal_window_hide_notification (GcalWindow *window);
|
void gcal_window_hide_notification (GcalWindow *window);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user