Added position saving
This commit is contained in:
parent
4adbaaa904
commit
272948b309
|
@ -145,6 +145,9 @@ struct _GmAppViewPrivate {
|
|||
GdkCursor *cursor;
|
||||
|
||||
guint tray_idle_create;
|
||||
|
||||
gint position_left;
|
||||
gint position_top;
|
||||
};
|
||||
|
||||
/* Signals */
|
||||
|
@ -615,7 +618,19 @@ gm_app_view_init(GmAppView *view) {
|
|||
gm_app_view_create_tray(view);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gm_app_view_store_position(GmAppView *view) {
|
||||
gtk_window_get_position(GTK_WINDOW(view), &(view->priv->position_left),
|
||||
&(view->priv->position_top));
|
||||
}
|
||||
|
||||
static void
|
||||
gm_app_view_restore_position(GmAppView *view) {
|
||||
gtk_window_move(GTK_WINDOW(view), view->priv->position_left,
|
||||
view->priv->position_top);
|
||||
}
|
||||
|
||||
static void
|
||||
gm_app_view_restore_size(GmAppView *view) {
|
||||
gint width, height;
|
||||
|
||||
|
@ -855,6 +870,7 @@ gm_app_view_toggle_visibility(GmAppView *view) {
|
|||
if (!visible || !gtk_window_is_active(GTK_WINDOW(view))) {
|
||||
if (!visible) {
|
||||
gm_app_view_restore_size(view);
|
||||
gm_app_view_restore_position(view);
|
||||
}
|
||||
|
||||
gtk_widget_show(GTK_WIDGET(view));
|
||||
|
@ -866,6 +882,7 @@ gm_app_view_toggle_visibility(GmAppView *view) {
|
|||
gm_tray_normal(view->priv->tray);
|
||||
}
|
||||
} else if (view->priv->tray) {
|
||||
gm_app_view_store_position(view);
|
||||
gtk_widget_hide(GTK_WIDGET(view));
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue