]> www.fi.muni.cz Git - evince.git/blobdiff - libmisc/ev-page-action-widget.c
[dualscreen] fix crash on ctrl+w and fix control window closing
[evince.git] / libmisc / ev-page-action-widget.c
index 2b29e785ddcbc6300db4c750a50dea79981c85a7..2bc74e603024c5a247bc8cfbeadea4542e22872d 100644 (file)
@@ -14,7 +14,7 @@
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  */
 
@@ -127,11 +127,14 @@ activate_cb (EvPageActionWidget *action_widget)
 {
        EvDocumentModel *model;
        const char *text;
-       gchar *page_label;
        EvLinkDest *link_dest;
        EvLinkAction *link_action;
        EvLink *link;
        gchar *link_text;
+       gint current_page;
+
+       model = action_widget->doc_model;
+       current_page = ev_document_model_get_page (model);
 
        text = gtk_entry_get_text (GTK_ENTRY (action_widget->entry));
 
@@ -145,14 +148,8 @@ activate_cb (EvPageActionWidget *action_widget)
        g_object_unref (link);
        g_free (link_text);
 
-       /* rest the entry to the current page if we were unable to
-        * change it */
-       model = action_widget->doc_model;
-       page_label = ev_document_get_page_label (action_widget->document,
-                                                ev_document_model_get_page (model));
-       gtk_entry_set_text (GTK_ENTRY (action_widget->entry), page_label);
-       gtk_editable_set_position (GTK_EDITABLE (action_widget->entry), -1);
-       g_free (page_label);
+       if (current_page == ev_document_model_get_page (model))
+               ev_page_action_widget_set_current_page (action_widget, current_page);
 }
 
 static void
@@ -274,7 +271,7 @@ ev_page_action_widget_class_init (EvPageActionWidgetClass *class)
                g_signal_new ("activate_link",
                              G_OBJECT_CLASS_TYPE (object_class),
                              G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-                             G_STRUCT_OFFSET (EvPageActionClass, activate_link),
+                             G_STRUCT_OFFSET (EvPageActionWidgetClass, activate_link),
                              NULL, NULL,
                              g_cclosure_marshal_VOID__OBJECT,
                              G_TYPE_NONE, 1,