static void notebook_page_reordered_cb (GtkWidget *notebook, GtkWidget *tab, guint position, EphySession *session) { ephy_session_save (session, SESSION_STATE); }
static void load_changed_cb (WebKitWebView *view, WebKitLoadEvent load_event, EphySession *session) { if (!ephy_web_view_load_failed (EPHY_WEB_VIEW (view))) ephy_session_save (session, SESSION_STATE); }
static void window_removed_cb (GtkApplication *application, GtkWindow *window, EphySession *session) { ephy_session_save (session, SESSION_STATE); /* NOTE: since the window will be destroyed anyway, we don't need to * disconnect our signal handlers from its components. */ }
static void load_status_notify_cb (EphyWebView *view, GParamSpec *pspec, EphySession *session) { WebKitLoadStatus status = webkit_web_view_get_load_status (WEBKIT_WEB_VIEW (view)); /* We won't know the URL we are loading in PROVISIONAL because of bug #593149, but save session anyway */ if (status == WEBKIT_LOAD_PROVISIONAL || status == WEBKIT_LOAD_COMMITTED || status == WEBKIT_LOAD_FINISHED) ephy_session_save (session, SESSION_STATE); }
static void impl_detach_window (EphyExtension *extension, EphyWindow *window) { EphySession *session = EPHY_SESSION (extension); LOG ("impl_detach_window"); session->priv->windows = g_list_remove (session->priv->windows, window); ephy_session_save (session, SESSION_STATE); /* NOTE: since the window will be destroyed anyway, we don't need to * disconnect our signal handlers from its components. */ }
static void notebook_page_removed_cb (GtkWidget *notebook, EphyEmbed *embed, guint position, EphySession *session) { ephy_session_save (session, SESSION_STATE); #ifdef HAVE_WEBKIT2 g_signal_handlers_disconnect_by_func (ephy_embed_get_web_view (embed), G_CALLBACK (load_changed_cb), session); #else g_signal_handlers_disconnect_by_func (ephy_embed_get_web_view (embed), G_CALLBACK (load_status_notify_cb), session); #endif }
static void window_added_cb (GtkApplication *application, GtkWindow *window, EphySession *session) { GtkWidget *notebook; EphyWindow *ephy_window; ephy_session_save (session, SESSION_STATE); if (!EPHY_IS_WINDOW (window)) return; ephy_window = EPHY_WINDOW (window); notebook = ephy_window_get_notebook (ephy_window); g_signal_connect (notebook, "page-added", G_CALLBACK (notebook_page_added_cb), session); g_signal_connect (notebook, "page-removed", G_CALLBACK (notebook_page_removed_cb), session); g_signal_connect (notebook, "page-reordered", G_CALLBACK (notebook_page_reordered_cb), session); /* Set unique identifier as role, so that on restore, the WM can * place the window on the right workspace */ if (gtk_window_get_role (window) == NULL) { /* I guess rand() is unique enough, otherwise we could use * time + pid or something */ char *role; role = g_strdup_printf ("epiphany-window-%x", rand()); gtk_window_set_role (window, role); g_free (role); } }
static void impl_attach_window (EphyExtension *extension, EphyWindow *window) { EphySession *session = EPHY_SESSION (extension); GtkWidget *notebook; LOG ("impl_attach_window"); session->priv->windows = g_list_append (session->priv->windows, window); ephy_session_save (session, SESSION_STATE); g_signal_connect (window, "focus-in-event", G_CALLBACK (window_focus_in_event_cb), session); notebook = ephy_window_get_notebook (window); g_signal_connect (notebook, "page-added", G_CALLBACK (notebook_page_added_cb), session); g_signal_connect (notebook, "page-removed", G_CALLBACK (notebook_page_removed_cb), session); g_signal_connect (notebook, "page-reordered", G_CALLBACK (notebook_page_reordered_cb), session); /* Set unique identifier as role, so that on restore, the WM can * place the window on the right workspace */ if (gtk_window_get_role (GTK_WINDOW (window)) == NULL) { /* I guess rand() is unique enough, otherwise we could use * time + pid or something */ char *role; role = g_strdup_printf ("epiphany-window-%x", rand()); gtk_window_set_role (GTK_WINDOW (window), role); g_free (role); } }