~ubuntu-branches/ubuntu/vivid/liferea/vivid-proposed

« back to all changes in this revision

Viewing changes to .pc/libunity.patch/src/ui/liferea_shell.c

  • Committer: Package Import Robot
  • Author(s): bojo42
  • Date: 2012-03-29 14:17:21 UTC
  • mfrom: (1.3.9) (3.2.5 sid)
  • Revision ID: package-import@ubuntu.com-20120329141721-tbfopcrc5797wxt7
Tags: 1.8.3-0.1ubuntu1
* New upstream release (LP: #290666, #371754, #741543, #716688)
* Merge from Debian unstable (LP: #935147), remaining changes:
* debian/patches:
  - drop gtk-status-icon.patch & notification-append as in upstream
  - drop fix_systray_behavior as mostly upstreamed and rest seems unused
  - 01_ubuntu_feedlists: update & rename, move planets to "Open Source"  
  - add_X-Ubuntu-Gettext-Domain: rebase
  - libunity.patch: rebase, apply before indicator patch (liferea_shell.c)
  - libindicate_increase_version.patch: exclude from libindicate.patch
  - deactivate libindicate.patch, seems partly upstreamed and needs rework
* debian/control: libindicate-dev, libindicate-gtk-dev & libunity-dev
* debian/liferea.indicate & liferea.install: ship indicator desktop file
* debian/rules: enable libindicate

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * @file ui_shell.c  UI layout handling
3
3
 *
4
4
 * Copyright (C) 2004-2006 Nathan J. Conrad <t98502@users.sourceforge.net>
5
 
 * Copyright (C) 2007-2008 Lars Lindner <lars.lindner@gmail.com>
 
5
 * Copyright (C) 2007-2011 Lars Lindner <lars.lindner@gmail.com>
6
6
 *
7
7
 * This program is free software; you can redistribute it and/or modify
8
8
 * it under the terms of the GNU General Public License as published by
26
26
#include "ui/liferea_shell.h"
27
27
 
28
28
#include <gtk/gtk.h>
29
 
#include <gdk/gdk.h>
30
29
#include <gdk/gdkkeysyms.h>
31
 
#include <glade/glade.h>
32
 
#include <string.h>             /* strcmp() and strsep() */
33
30
 
34
31
#include "browser.h"
35
32
#include "common.h"
39
36
#include "feedlist.h"
40
37
#include "htmlview.h"
41
38
#include "itemlist.h"
42
 
#include "net.h"
43
 
#include "notification/notification.h"
 
39
#include "net_monitor.h"
44
40
#include "ui/browser_tabs.h"
 
41
#include "ui/feed_list_view.h"
 
42
#include "ui/icons.h"
45
43
#include "ui/itemview.h"
 
44
#include "ui/item_list_view.h"
46
45
#include "ui/liferea_dialog.h"
 
46
#include "ui/search_dialog.h"
47
47
#include "ui/ui_common.h"
48
 
#include "ui/ui_feedlist.h"
49
 
#include "ui/ui_indicator.h"
50
 
#include "ui/ui_itemlist.h"
51
48
#include "ui/ui_prefs.h"
52
 
#include "ui/ui_script.h"
53
 
#include "ui/ui_search.h"
54
 
#include "ui/search_dialog.h"
55
49
#include "ui/ui_session.h"
56
50
#include "ui/ui_tray.h"
57
51
#include "ui/ui_update.h"
58
52
 
59
 
/* all used icons (FIXME: evil) */
60
 
GdkPixbuf *icons[MAX_ICONS];
61
 
 
62
 
static void liferea_shell_class_init    (LifereaShellClass *klass);
63
 
static void liferea_shell_init          (LifereaShell *ls);
64
 
 
65
53
#define LIFEREA_SHELL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), LIFEREA_SHELL_TYPE, LifereaShellPrivate))
66
54
 
67
55
struct LifereaShellPrivate {
68
 
        GladeXML        *xml;
 
56
        GtkBuilder      *xml;
69
57
 
70
58
        GtkWindow       *window;                /**< Liferea main window */
71
59
        GtkWidget       *menubar;
82
70
        GtkActionGroup  *feedActions;           /**< update and mark read */
83
71
        GtkActionGroup  *readWriteActions;      /**< node remove and properties, node itemset items remove */
84
72
        GtkActionGroup  *itemActions;           /**< item state toggline, single item remove */
85
 
        
 
73
 
 
74
        ItemList        *itemlist;      
86
75
        FeedList        *feedlist;
87
76
        ItemView        *itemview;
88
77
        BrowserTabs     *tabs;
91
80
static GObjectClass *parent_class = NULL;
92
81
static LifereaShell *shell = NULL;
93
82
 
94
 
GType
95
 
liferea_shell_get_type (void) 
96
 
{
97
 
        static GType type = 0;
98
 
 
99
 
        if (G_UNLIKELY (type == 0)) 
100
 
        {
101
 
                static const GTypeInfo our_info = 
102
 
                {
103
 
                        sizeof (LifereaShellClass),
104
 
                        NULL, /* base_init */
105
 
                        NULL, /* base_finalize */
106
 
                        (GClassInitFunc) liferea_shell_class_init,
107
 
                        NULL,
108
 
                        NULL, /* class_data */
109
 
                        sizeof (LifereaShell),
110
 
                        0, /* n_preallocs */
111
 
                        (GInstanceInitFunc) liferea_shell_init
112
 
                };
113
 
 
114
 
                type = g_type_register_static (G_TYPE_OBJECT,
115
 
                                               "LifereaShell",
116
 
                                               &our_info, 0);
117
 
        }
118
 
 
119
 
        return type;
120
 
}
 
83
G_DEFINE_TYPE (LifereaShell, liferea_shell, G_TYPE_OBJECT);
121
84
 
122
85
static void
123
86
liferea_shell_finalize (GObject *object)
147
110
        g_return_val_if_fail (shell != NULL, NULL);
148
111
        g_return_val_if_fail (shell->priv != NULL, NULL);
149
112
 
150
 
        return glade_xml_get_widget (shell->priv->xml, name);
 
113
        return GTK_WIDGET (gtk_builder_get_object (shell->priv->xml, name));
151
114
}
152
115
 
153
116
static void
154
117
liferea_shell_init (LifereaShell *ls)
155
118
{
 
119
        /* FIXME: we should only need to load mainwindow, but GtkBuilder won't
 
120
         * load the other required objects, so we need to do it manually...
 
121
         * See fixme in liferea_dialog_new()
 
122
         * http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508585
 
123
         */
 
124
        gchar *objs[] = { "adjustment6", "mainwindow", NULL };
156
125
        /* globally accessible singleton */
157
126
        g_assert (NULL == shell);
158
127
        shell = ls;
159
128
        
160
129
        shell->priv = LIFEREA_SHELL_GET_PRIVATE (ls);
161
 
        shell->priv->xml = glade_xml_new (PACKAGE_DATA_DIR G_DIR_SEPARATOR_S PACKAGE G_DIR_SEPARATOR_S "liferea.glade", "mainwindow", GETTEXT_PACKAGE);
162
 
        glade_xml_signal_autoconnect (shell->priv->xml);
 
130
        shell->priv->xml = gtk_builder_new ();
 
131
        if (!gtk_builder_add_objects_from_file (shell->priv->xml, PACKAGE_DATA_DIR G_DIR_SEPARATOR_S PACKAGE G_DIR_SEPARATOR_S "liferea.ui", objs, NULL))
 
132
                g_error ("Loading " PACKAGE_DATA_DIR G_DIR_SEPARATOR_S PACKAGE G_DIR_SEPARATOR_S  "liferea.ui failed");
 
133
 
 
134
        gtk_builder_connect_signals (shell->priv->xml, NULL);
163
135
}
164
136
 
165
137
/**
171
143
{
172
144
        /* load window position */
173
145
        int x, y, w, h;
174
 
 
175
 
        x = conf_get_int_value (LAST_WINDOW_X);
176
 
        y = conf_get_int_value (LAST_WINDOW_Y);
177
 
 
178
 
        w = conf_get_int_value (LAST_WINDOW_WIDTH);
179
 
        h = conf_get_int_value (LAST_WINDOW_HEIGHT);
 
146
        gboolean last_window_maximized;
 
147
 
 
148
        conf_get_int_value (LAST_WINDOW_X, &x);
 
149
        conf_get_int_value (LAST_WINDOW_Y, &y);
 
150
 
 
151
        conf_get_int_value (LAST_WINDOW_WIDTH, &w);
 
152
        conf_get_int_value (LAST_WINDOW_HEIGHT, &h);
180
153
        
181
154
        debug4 (DEBUG_GUI, "Retrieved saved setting: size %dx%d position %d:%d", w, h, x, y);
182
155
        
201
174
                gtk_window_resize (GTK_WINDOW (shell->priv->window), w, h);
202
175
        }
203
176
 
204
 
        if (conf_get_bool_value (LAST_WINDOW_MAXIMIZED))
 
177
        conf_get_bool_value (LAST_WINDOW_MAXIMIZED, &last_window_maximized);
 
178
 
 
179
        if (last_window_maximized)
205
180
                gtk_window_maximize (GTK_WINDOW (shell->priv->window));
206
181
        else
207
182
                gtk_window_unmaximize (GTK_WINDOW (shell->priv->window));
213
188
{
214
189
        GtkWidget       *pane;
215
190
        gint            x, y, w, h;
 
191
        gboolean        last_window_maximized;
216
192
 
217
193
        /* save pane proportions */
218
194
        pane = liferea_shell_lookup ("leftpane");
234
210
        }
235
211
        
236
212
        /* The following needs to be skipped when the window is not visible */
237
 
        if (!GTK_WIDGET_VISIBLE (shell->priv->window))
 
213
        if (!gtk_widget_get_visible (GTK_WIDGET (shell->priv->window)))
238
214
                return;
239
215
 
240
 
        if (conf_get_bool_value (LAST_WINDOW_MAXIMIZED))
 
216
        conf_get_bool_value (LAST_WINDOW_MAXIMIZED, &last_window_maximized);
 
217
 
 
218
        if (last_window_maximized)
241
219
                return;
242
220
 
243
221
        gtk_window_get_position (shell->priv->window, &x, &y);
264
242
{       
265
243
        if (!toolbar_style) /* default to icons */
266
244
                gtk_toolbar_set_style (GTK_TOOLBAR (shell->priv->toolbar), GTK_TOOLBAR_ICONS);
267
 
        else if (!strcmp (toolbar_style, "text"))
 
245
        else if (g_str_equal (toolbar_style, "text"))
268
246
                gtk_toolbar_set_style (GTK_TOOLBAR (shell->priv->toolbar), GTK_TOOLBAR_TEXT);
269
 
        else if (!strcmp (toolbar_style, "both"))
 
247
        else if (g_str_equal (toolbar_style, "both"))
270
248
                gtk_toolbar_set_style (GTK_TOOLBAR (shell->priv->toolbar), GTK_TOOLBAR_BOTH);
271
 
        else if (!strcmp (toolbar_style, "both_horiz") || !strcmp (toolbar_style, "both-horiz") )
 
249
        else if (g_str_equal (toolbar_style, "both_horiz") || g_str_equal (toolbar_style, "both-horiz") )
272
250
                gtk_toolbar_set_style (GTK_TOOLBAR (shell->priv->toolbar), GTK_TOOLBAR_BOTH_HORIZ);
273
251
        else /* default to icons */
274
252
                gtk_toolbar_set_style (GTK_TOOLBAR (shell->priv->toolbar), GTK_TOOLBAR_ICONS);
277
255
void
278
256
liferea_shell_update_toolbar (void)
279
257
{
280
 
        if (conf_get_bool_value (DISABLE_TOOLBAR))
 
258
        gboolean disable_toolbar;
 
259
 
 
260
        conf_get_bool_value (DISABLE_TOOLBAR, &disable_toolbar);
 
261
 
 
262
        if (disable_toolbar)
281
263
                gtk_widget_hide (shell->priv->toolbar);
282
264
        else
283
265
                gtk_widget_show (shell->priv->toolbar);
474
456
        GtkWidget* child;
475
457
        GtkWidget* originator;
476
458
 
477
 
        if (!notebook->cur_page)
 
459
        if (!gtk_notebook_get_current_page (notebook))
478
460
                return FALSE;
479
461
 
480
462
        child = gtk_notebook_get_nth_page (notebook, gtk_notebook_get_current_page (notebook));
490
472
static gboolean
491
473
on_close (GtkWidget *widget, GdkEvent *event, gpointer user_data)
492
474
{
493
 
        if (!ui_indicator_is_visible () && (ui_tray_get_count() == 0 || (conf_get_bool_value (DONT_MINIMIZE_TO_TRAY)))) {
 
475
        gboolean dont_maximize_to_tray;
 
476
 
 
477
        conf_get_bool_value (DONT_MINIMIZE_TO_TRAY, &dont_maximize_to_tray);
 
478
 
 
479
        if ((ui_tray_get_count() == 0) || dont_maximize_to_tray) {
494
480
                liferea_shutdown ();
495
481
                return TRUE;
496
482
        }
530
516
        guint           default_modifiers;
531
517
        const gchar     *type;
532
518
        GtkWidget       *focusw;
 
519
        gint            browse_key_setting;
533
520
 
534
521
        if (event->type == GDK_KEY_PRESS) {
535
522
                default_modifiers = gtk_accelerator_get_default_mod_mask ();
537
524
                /* handle [<modifier>+]<Space> headline skimming hotkey */
538
525
                switch (event->keyval) {
539
526
                        case GDK_space:
540
 
                                switch (conf_get_int_value (BROWSE_KEY_SETTING)) {
 
527
                                conf_get_int_value (BROWSE_KEY_SETTING, &browse_key_setting);
 
528
                                switch (browse_key_setting) {
541
529
                                        default:
542
530
                                        case 0:
543
531
                                                modifier_matches = ((event->state & default_modifiers) == 0);
587
575
                        return FALSE;
588
576
 
589
577
                /* prevent usage of navigation keys in HTML view */
590
 
                type = g_type_name (GTK_WIDGET_TYPE (focusw));
591
 
                if (type && (!strcmp (type, "WebKitWebView")))
 
578
                type = g_type_name (G_OBJECT_TYPE (focusw));
 
579
                if (type && (g_str_equal (type, "WebKitWebView")))
592
580
                        return FALSE;
593
581
                
594
582
                /* check for treeview navigation */
595
583
                if (0 == (event->state & default_modifiers)) {
596
584
                        switch (event->keyval) {
597
585
                                case GDK_KP_Delete:
598
 
 
599
586
                                case GDK_Delete:
600
587
                                        if (focusw == GTK_WIDGET (shell->priv->feedlistView))
601
 
                                                return FALSE;   /* to be handled in ui_feedlist_key_press_cb() */
 
588
                                                return FALSE;   /* to be handled in feed_list_view_key_press_cb() */
602
589
                                                
603
590
                                        on_remove_item_activate (NULL, NULL);
604
591
                                        return TRUE;
660
647
void
661
648
on_onlinebtn_clicked (GtkButton *button, gpointer user_data)
662
649
{
663
 
        network_set_online (!network_is_online ());
 
650
        network_monitor_set_online (!network_monitor_is_online ());
664
651
}
665
652
 
666
653
static void
667
654
on_work_offline_activate (GtkToggleAction *menuitem, gpointer user_data)
668
655
{
669
 
        network_set_online (!gtk_toggle_action_get_active (menuitem));
 
656
        network_monitor_set_online (!gtk_toggle_action_get_active (menuitem));
670
657
}
671
658
 
672
659
static void
681
668
}
682
669
 
683
670
static void
 
671
liferea_shell_add_html_tab (const gchar *file, const gchar *name)
 
672
{
 
673
        gchar *filepattern = g_strdup_printf (PACKAGE_DATA_DIR "/" PACKAGE "/doc/html/%s", file);
 
674
        gchar *filename = common_get_localized_filename (filepattern);
 
675
        gchar *fileuri = g_strdup_printf ("file://%s", filename);
 
676
 
 
677
        browser_tabs_add_new (fileuri, name, TRUE);
 
678
 
 
679
        g_free (filepattern);
 
680
        g_free (filename);
 
681
        g_free (fileuri);
 
682
}
 
683
 
 
684
static void
684
685
on_topics_activate (GtkMenuItem *menuitem, gpointer user_data)
685
686
{
686
 
        gchar *filename = g_strdup_printf ("file://" PACKAGE_DATA_DIR "/" PACKAGE "/doc/html/%s", _("topics_en.html"));
687
 
        browser_tabs_add_new (filename, _("Help Topics"), TRUE);
688
 
        g_free (filename);
 
687
        liferea_shell_add_html_tab ("topics_%s.html", _("Help Topics"));
689
688
}
690
689
 
691
690
static void
692
691
on_quick_reference_activate (GtkMenuItem *menuitem, gpointer user_data)
693
692
{
694
 
        gchar *filename = g_strdup_printf ("file://" PACKAGE_DATA_DIR "/" PACKAGE "/doc/html/%s", _("reference_en.html"));
695
 
        browser_tabs_add_new (filename, _("Quick Reference"), TRUE);
696
 
        g_free (filename);
 
693
        liferea_shell_add_html_tab ("reference_%s.html", _("Quick Reference"));
697
694
}
698
695
 
699
696
static void
700
697
on_faq_activate (GtkMenuItem *menuitem, gpointer user_data)
701
698
{
702
 
        gchar *filename = g_strdup_printf ("file://" PACKAGE_DATA_DIR "/" PACKAGE "/doc/html/%s", _("faq_en.html"));
703
 
        browser_tabs_add_new (filename, _("FAQ"), TRUE);
704
 
        g_free (filename);
 
699
        liferea_shell_add_html_tab ("faq_%s.html", _("FAQ"));
705
700
}
706
701
 
707
702
static void
734
729
        export_OPML_file ();
735
730
}
736
731
 
737
 
// FIXME: change to signal callback
738
 
void
739
 
liferea_shell_online_status_changed (int online)
 
732
static void
 
733
liferea_shell_set_online_icon (gboolean online)
740
734
{
741
735
        GtkWidget       *widget;
742
736
 
743
 
        if (!shell)
744
 
                return; // FIXME: this check shouldn't be necessary
745
 
 
746
737
        widget = liferea_shell_lookup ("onlineimage");
747
738
 
748
739
        if (online) {
749
740
                liferea_shell_set_status_bar (_("Liferea is now online"));
750
 
                gtk_image_set_from_pixbuf (GTK_IMAGE (widget), icons[ICON_ONLINE]);
751
 
                atk_object_set_name (gtk_widget_get_accessible (widget), _("Work Offline"));            
 
741
                gtk_image_set_from_pixbuf (GTK_IMAGE (widget), (GdkPixbuf *)icon_get (ICON_ONLINE));
 
742
                atk_object_set_name (gtk_widget_get_accessible (widget), _("Work Offline"));    
752
743
        } else {
753
744
                liferea_shell_set_status_bar (_("Liferea is now offline"));
754
 
                gtk_image_set_from_pixbuf (GTK_IMAGE (widget), icons[ICON_OFFLINE]);
 
745
                gtk_image_set_from_pixbuf (GTK_IMAGE (widget), (GdkPixbuf *)icon_get (ICON_OFFLINE));
755
746
                atk_object_set_name (gtk_widget_get_accessible (widget), _("Work Online"));     
756
747
        }
757
748
        gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (gtk_action_group_get_action (shell->priv->generalActions, "ToggleOfflineMode")), !online);
 
749
}
758
750
 
759
 
        /* Propagate new online status to other interested widgets */
760
 
        // FIXME: bad design, HTML view implementation needs to register for network events itself
761
 
        liferea_htmlview_set_online (online);
 
751
static void
 
752
liferea_shell_online_status_changed (NetworkMonitor *nm, gboolean online, gpointer userdata)
 
753
{
 
754
        liferea_shell_set_online_icon (online);
762
755
        ui_tray_update ();
763
756
}
764
757
 
765
758
/* methods to receive URLs which were dropped anywhere in the main window */
766
759
static void
767
 
liferea_shell_URL_received (GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint info, guint time)
 
760
liferea_shell_URL_received (GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint info, guint time_received)
768
761
{
769
762
        gchar           *tmp1, *tmp2, *freeme;
770
763
        GtkWidget       *mainwindow;
776
769
        nodePtr         node;
777
770
        gint            tx, ty;
778
771
        
779
 
        g_return_if_fail (data->data != NULL);
 
772
        g_return_if_fail (gtk_selection_data_get_data (data) != NULL);
780
773
                
781
 
        mainwindow = GTK_WIDGET (liferea_shell_lookup ("mainwindow"));
782
 
        treeview = GTK_TREE_VIEW (liferea_shell_lookup ("feedlist"));
 
774
        mainwindow = GTK_WIDGET (shell->priv->window);
 
775
        treeview = GTK_TREE_VIEW (shell->priv->feedlistView);
783
776
        model = gtk_tree_view_get_model (treeview);
784
777
 
 
778
        /* x and y are relative to the main window, make them relative to the treeview */
 
779
        gtk_widget_translate_coordinates (mainwindow, GTK_WIDGET (treeview), x, y, &tx, &ty);
 
780
 
785
781
        /* Allow link drops only over feed list widget. This is to avoid
786
782
           the frequent accidental text drops in the HTML view. */
787
783
 
789
785
 
790
786
        if((x > alloc.x+alloc.width) || (x < alloc.x) ||
791
787
           (y > alloc.y+alloc.height) || (y < alloc.y)) {
792
 
                gtk_drag_finish (context, FALSE, FALSE, time);
 
788
                gtk_drag_finish (context, FALSE, FALSE, time_received);
793
789
                return;
794
790
        }               
795
791
 
796
 
        /* x and y are relative to the main window, make them relative to the treeview */
797
 
        g_assert (gtk_widget_translate_coordinates (mainwindow, GTK_WIDGET (treeview), x, y, &tx, &ty));
798
 
 
799
 
        if ((data->length >= 0) && (data->format == 8)) {
800
 
                /* extra handling to accept multiple drops */   
801
 
                freeme = tmp1 = g_strdup (data->data);
 
792
        if ((gtk_selection_data_get_length (data) >= 0) && (gtk_selection_data_get_format (data) == 8)) {
 
793
                /* extra handling to accept multiple drops */
 
794
                freeme = tmp1 = g_strdup (gtk_selection_data_get_data (data));
802
795
                while ((tmp2 = strsep (&tmp1, "\n\r"))) {
803
796
                        if (strlen (tmp2)) {
804
797
                                /* if the drop is over a node, select it so that feedlist_add_subscription()
806
799
                                if (gtk_tree_view_get_dest_row_at_pos (treeview, tx, ty, &path, NULL)) {
807
800
                                        if (gtk_tree_model_get_iter (model, &iter, path)) {
808
801
                                                gtk_tree_model_get (model, &iter, FS_PTR, &node, -1);
809
 
                                                /* if node is NULL, ui_feedlist_select() will unselect the tv */
810
 
                                                ui_feedlist_select (node);
 
802
                                                /* if node is NULL, feed_list_view_select() will unselect the tv */
 
803
                                                feed_list_view_select (node);
811
804
                                        }
812
805
                                        gtk_tree_path_free (path);
813
806
                                }
814
807
                                feedlist_add_subscription (g_strdup (tmp2), NULL, NULL,
815
 
                                                           FEED_REQ_RESET_TITLE |
816
808
                                                           FEED_REQ_PRIORITY_HIGH);
817
809
                        }
818
810
                }
819
811
                g_free (freeme);
820
 
                gtk_drag_finish (context, TRUE, FALSE, time);           
 
812
                gtk_drag_finish (context, TRUE, FALSE, time_received);
821
813
        } else {
822
 
                gtk_drag_finish (context, FALSE, FALSE, time);
 
814
                gtk_drag_finish (context, FALSE, FALSE, time_received);
823
815
        }
824
816
}
825
817
 
826
 
void
827
 
liferea_shell_setup_URL_receiver (GtkWidget *widget)
 
818
static void
 
819
liferea_shell_setup_URL_receiver (void)
828
820
{
 
821
        GtkWidget *mainwindow;
829
822
        GtkTargetEntry target_table[] = {
830
 
                { "STRING",                     0, 0 },
831
 
                { "text/plain",                 0, 0 },
832
 
                { "text/uri-list",              0, 1 },
833
 
                { "_NETSCAPE_URL",              0, 1 },
834
 
                { "application/x-rootwin-drop", 0, 2 }
 
823
                { "STRING",                     GTK_TARGET_OTHER_WIDGET, 0 },
 
824
                { "text/plain",                 GTK_TARGET_OTHER_WIDGET, 0 },
 
825
                { "text/uri-list",              GTK_TARGET_OTHER_WIDGET, 1 },
 
826
                { "_NETSCAPE_URL",              GTK_TARGET_OTHER_APP, 1 },
 
827
                { "application/x-rootwin-drop", GTK_TARGET_OTHER_APP, 2 }
835
828
        };
836
829
 
 
830
        mainwindow = GTK_WIDGET (shell->priv->window);
 
831
 
837
832
        /* doesn't work with GTK_DEST_DEFAULT_DROP... */
838
 
        gtk_drag_dest_set (widget, GTK_DEST_DEFAULT_ALL,
 
833
        gtk_drag_dest_set (mainwindow, GTK_DEST_DEFAULT_ALL,
839
834
                           target_table, sizeof (target_table)/sizeof (target_table[0]),
840
835
                           GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
841
836
                       
842
 
        g_signal_connect (G_OBJECT (widget), "drag_data_received",
 
837
        g_signal_connect (G_OBJECT (mainwindow), "drag_data_received",
843
838
                          G_CALLBACK (liferea_shell_URL_received), NULL);
844
839
}
845
840
 
846
 
static const GtkActionEntry ui_mainwindow_action_entries[] = {
 
841
static const GtkActionEntry liferea_shell_action_entries[] = {
847
842
        {"SubscriptionsMenu", NULL, N_("_Subscriptions")},
848
843
        {"UpdateAll", "gtk-refresh", N_("Update _All"), "<control>U", N_("Updates all subscriptions."),
849
844
         G_CALLBACK(on_menu_update_all)},
858
853
         G_CALLBACK(on_remove_items_activate)},
859
854
 
860
855
        {"ItemMenu", NULL, N_("_Item")},
861
 
        {"NextUnreadItem", GTK_STOCK_GO_FORWARD, N_("_Next Unread Item"), "<control>N", N_("Jumps to the next unread item. If necessary selects the next feed with unread items."),
 
856
        /* No tooltip here as it really hinders usability to have it flashing
 
857
           when skimming through items using "Next Unread"! */
 
858
        {"NextUnreadItem", GTK_STOCK_GO_FORWARD, N_("_Next Unread Item"), "<control>N", NULL,   
862
859
         G_CALLBACK(on_next_unread_item_activate)},
863
860
 
864
861
        {"ViewMenu", NULL, N_("_View")},
870
867
        {"ToolsMenu", NULL, N_("_Tools")},
871
868
        {"ShowUpdateMonitor", NULL, N_("_Update Monitor"), NULL, N_("Show a list of all feeds currently in the update queue"),
872
869
         G_CALLBACK(on_menu_show_update_monitor)},
873
 
        {"ShowScriptManager", NULL, N_("_Script Manager"), NULL, N_("Allows to configure and edit LUA hook scripts"),
874
 
         G_CALLBACK(on_menu_show_script_manager)},
875
870
        {"ShowPreferences", GTK_STOCK_PREFERENCES, N_("_Preferences"), NULL, N_("Edit Preferences."),
876
871
         G_CALLBACK(on_prefbtn_clicked)},
877
872
 
878
873
        {"SearchMenu", NULL, N_("S_earch")},
879
874
        {"SearchFeeds", "gtk-find", N_("Search All Feeds..."), "<control>F", N_("Show the search dialog."), G_CALLBACK(on_searchbtn_clicked)},
880
 
        {"CreateEngineSearch", NULL, N_("Search With ...")},
881
875
 
882
876
        {"HelpMenu", NULL, N_("_Help")},
883
877
        {"ShowHelpContents", "gtk-help", N_("_Contents"), "F1", N_("View help for this application."), G_CALLBACK(on_topics_activate)},
887
881
        {"ShowAbout", "gtk-about", N_("_About"), NULL, N_("Shows an about dialog."), G_CALLBACK(on_about_activate)}
888
882
};
889
883
 
890
 
static const GtkRadioActionEntry ui_mainwindow_view_radio_entries[] = {
 
884
static const GtkRadioActionEntry liferea_shell_view_radio_entries[] = {
891
885
        {"NormalView", NULL, N_("_Normal View"), NULL, N_("Set view mode to mail client mode."),
892
886
         0},
893
887
        {"WideView", NULL, N_("_Wide View"), NULL, N_("Set view mode to use three vertical panes."),
896
890
         2}
897
891
};
898
892
 
899
 
static GtkToggleActionEntry ui_mainwindow_feedlist_toggle_entries[] = {
 
893
static GtkToggleActionEntry liferea_shell_feedlist_toggle_entries[] = {
900
894
        {"ReducedFeedList", NULL, N_("_Reduced Feed List"), NULL, N_("Hide feeds with no unread items."),
901
895
        G_CALLBACK(on_feedlist_reduced_activate)}
902
896
};
903
897
 
904
 
static const GtkActionEntry ui_mainwindow_add_action_entries[] = {
 
898
static const GtkActionEntry liferea_shell_add_action_entries[] = {
905
899
        {"NewSubscription", "gtk-add", N_("_New Subscription..."), NULL, N_("Adds a subscription to the feed list."),
906
900
         G_CALLBACK(on_menu_feed_new)},
907
901
        {"NewFolder", NULL, N_("New _Folder..."), NULL, N_("Adds a folder to the feed list."), G_CALLBACK(on_menu_folder_new)},
910
904
        {"NewNewsBin", NULL, N_("New _News Bin..."), NULL, N_("Adds a new news bin."), G_CALLBACK(on_new_newsbin_activate)}
911
905
};
912
906
 
913
 
static const GtkActionEntry ui_mainwindow_feed_action_entries[] = {
 
907
static const GtkActionEntry liferea_shell_feed_action_entries[] = {
914
908
        {"MarkFeedAsRead", "gtk-apply", N_("_Mark Items Read"), "<control>R", N_("Marks all items of the selected feed list node / in the item list as read."), 
915
909
         G_CALLBACK(on_menu_allread)},
916
910
        {"UpdateSelected", "gtk-refresh", N_("_Update"), NULL, N_("Updates the selected subscription or all subscriptions of the selected folder."),
917
911
         G_CALLBACK(on_menu_update)}
918
912
};
919
913
 
920
 
static const GtkActionEntry ui_mainwindow_read_write_action_entries[] = {
 
914
static const GtkActionEntry liferea_shell_read_write_action_entries[] = {
921
915
        {"Properties", "gtk-properties", N_("_Properties"), NULL, N_("Opens the property dialog for the selected subscription."), G_CALLBACK(on_menu_properties)},
922
916
        {"DeleteSelected", "gtk-delete", N_("_Remove"), NULL, N_("Removes the selected subscription."), G_CALLBACK(on_menu_delete)}
923
917
};
924
918
 
925
 
static const GtkActionEntry ui_mainwindow_item_action_entries[] = {
 
919
static const GtkActionEntry liferea_shell_item_action_entries[] = {
926
920
        {"ToggleItemReadStatus", "gtk-apply", N_("Toggle _Read Status"), "<control>M", N_("Toggles the read status of the selected item."),
927
921
         G_CALLBACK(on_toggle_unread_status)},
928
922
        {"ToggleItemFlag", NULL, N_("Toggle Item _Flag"), "<control>T", N_("Toggles the flag status of the selected item."),
933
927
         G_CALLBACK(on_popup_launchitem_selected)}
934
928
};
935
929
 
936
 
static const GtkToggleActionEntry ui_mainwindow_action_toggle_entries[] = {
 
930
static const GtkToggleActionEntry liferea_shell_action_toggle_entries[] = {
937
931
        {"ToggleOfflineMode", NULL, N_("_Work Offline"), NULL, N_("This option allows you to disable subscription updating."),
938
932
         G_CALLBACK(on_work_offline_activate)}
939
933
};
940
934
 
941
 
static const char *ui_mainwindow_ui_desc =
 
935
static const char *liferea_shell_ui_desc =
942
936
"<ui>"
943
937
"  <menubar name='MainwindowMenubar'>"
944
938
"    <menu action='SubscriptionsMenu'>"
988
982
"    </menu>"
989
983
"    <menu action='ToolsMenu'>"
990
984
"      <menuitem action='ShowUpdateMonitor'/>"
991
 
"      <menuitem action='ShowScriptManager'/>"
992
985
"      <menuitem action='ShowPreferences'/>"
993
986
"    </menu>"
994
987
"    <menu action='SearchMenu'>"
995
988
"      <menuitem action='SearchFeeds'/>"
996
 
"      <menu action='CreateEngineSearch'/>"
997
989
"    </menu>"
998
990
"    <menu action='HelpMenu'>"
999
991
"      <menuitem action='ShowHelpContents'/>"
1014
1006
"  </toolbar>"
1015
1007
"</ui>";
1016
1008
 
1017
 
static GdkPixbuf *
1018
 
liferea_shell_get_theme_icon (GtkIconTheme *icon_theme, const gchar *name, gint size)
1019
 
{
1020
 
        GError *error = NULL;
1021
 
        GdkPixbuf *pixbuf;
1022
 
 
1023
 
        pixbuf = gtk_icon_theme_load_icon (icon_theme,
1024
 
                                           name, /* icon name */
1025
 
                                           size, /* size */
1026
 
                                           0,  /* flags */
1027
 
                                           &error);
1028
 
        if (!pixbuf) {
1029
 
                debug1(DEBUG_GUI, "Couldn't load icon: %s", error->message);
1030
 
                g_error_free (error);
1031
 
        }
1032
 
        return pixbuf;
1033
 
}
1034
 
 
1035
1009
static void
1036
1010
liferea_shell_restore_state (void)
1037
1011
{
1038
1012
        gchar *toolbar_style, *accels_file;
 
1013
        gint last_vpane_pos, last_hpane_pos, last_wpane_pos;
1039
1014
        
1040
1015
        debug0 (DEBUG_GUI, "Setting toolbar style");
1041
1016
        
1055
1030
 
1056
1031
        debug0 (DEBUG_GUI, "Loading pane proportions");
1057
1032
                
1058
 
        if (0 != conf_get_int_value (LAST_VPANE_POS))
1059
 
                gtk_paned_set_position (GTK_PANED (liferea_shell_lookup ("leftpane")), conf_get_int_value (LAST_VPANE_POS));
1060
 
        if (0 != conf_get_int_value (LAST_HPANE_POS))
1061
 
                gtk_paned_set_position (GTK_PANED (liferea_shell_lookup ("normalViewPane")), conf_get_int_value (LAST_HPANE_POS));
1062
 
        if (0 != conf_get_int_value (LAST_WPANE_POS))
1063
 
                gtk_paned_set_position (GTK_PANED (liferea_shell_lookup ("wideViewPane")), conf_get_int_value (LAST_WPANE_POS));
 
1033
        conf_get_int_value (LAST_VPANE_POS, &last_vpane_pos);
 
1034
        if (last_vpane_pos)
 
1035
                gtk_paned_set_position (GTK_PANED (liferea_shell_lookup ("leftpane")), last_vpane_pos);
 
1036
        conf_get_int_value (LAST_HPANE_POS, &last_hpane_pos);
 
1037
        if (last_hpane_pos)
 
1038
                gtk_paned_set_position (GTK_PANED (liferea_shell_lookup ("normalViewPane")), last_hpane_pos);
 
1039
        conf_get_int_value (LAST_WPANE_POS, &last_wpane_pos);
 
1040
        if (last_wpane_pos)
 
1041
                gtk_paned_set_position (GTK_PANED (liferea_shell_lookup ("wideViewPane")), last_wpane_pos);
1064
1042
}
1065
1043
 
1066
1044
void
1069
1047
        GtkUIManager    *ui_manager;
1070
1048
        GtkAccelGroup   *accel_group;
1071
1049
        GError          *error = NULL;  
1072
 
        GtkWidget       *widget;
1073
 
        int             i;
1074
1050
        GString         *buffer;
1075
 
        GtkIconTheme    *icon_theme;
 
1051
        gboolean        show_tray_icon, toggle;
1076
1052
        
1077
1053
        debug_enter ("liferea_shell_create");
1078
1054
 
1081
1057
        g_object_new (LIFEREA_SHELL_TYPE, NULL);
1082
1058
 
1083
1059
        shell->priv->window = GTK_WINDOW (liferea_shell_lookup ("mainwindow"));
1084
 
 
1085
 
        // FIXME: do we use this anywhere?
1086
 
        gtk_widget_set_name (liferea_shell_lookup ("feedlist"), "feedlist");
1087
1060
        
1088
1061
        /* 2.) menu creation */
1089
1062
        
1090
1063
        debug0 (DEBUG_GUI, "Setting up menues");
1091
1064
 
 
1065
        shell->priv->itemlist = itemlist_create ();
 
1066
 
1092
1067
        /* Prepare some toggle button states */ 
1093
 
        ui_mainwindow_feedlist_toggle_entries[0].is_active = conf_get_bool_value (REDUCED_FEEDLIST);
 
1068
        conf_get_bool_value (REDUCED_FEEDLIST, &toggle);
 
1069
        liferea_shell_feedlist_toggle_entries[0].is_active = toggle;
1094
1070
 
1095
1071
        ui_manager = gtk_ui_manager_new ();
1096
1072
 
1097
1073
        shell->priv->generalActions = gtk_action_group_new ("GeneralActions");
1098
1074
        gtk_action_group_set_translation_domain (shell->priv->generalActions, PACKAGE);
1099
 
        gtk_action_group_add_actions (shell->priv->generalActions, ui_mainwindow_action_entries, G_N_ELEMENTS (ui_mainwindow_action_entries), shell->priv);
1100
 
        gtk_action_group_add_toggle_actions (shell->priv->generalActions, ui_mainwindow_action_toggle_entries, G_N_ELEMENTS (ui_mainwindow_action_toggle_entries), shell->priv);
1101
 
        gtk_action_group_add_radio_actions (shell->priv->generalActions, ui_mainwindow_view_radio_entries, G_N_ELEMENTS (ui_mainwindow_view_radio_entries), itemlist_get_view_mode (), (GCallback)on_view_activate, (gpointer)TRUE);
1102
 
        gtk_action_group_add_toggle_actions (shell->priv->generalActions, ui_mainwindow_feedlist_toggle_entries, G_N_ELEMENTS (ui_mainwindow_feedlist_toggle_entries), shell->priv);
 
1075
        gtk_action_group_add_actions (shell->priv->generalActions, liferea_shell_action_entries, G_N_ELEMENTS (liferea_shell_action_entries), shell->priv);
 
1076
        gtk_action_group_add_toggle_actions (shell->priv->generalActions, liferea_shell_action_toggle_entries, G_N_ELEMENTS (liferea_shell_action_toggle_entries), shell->priv);
 
1077
        gtk_action_group_add_radio_actions (shell->priv->generalActions, liferea_shell_view_radio_entries, G_N_ELEMENTS (liferea_shell_view_radio_entries), itemlist_get_view_mode (), (GCallback)on_view_activate, (gpointer)TRUE);
 
1078
        gtk_action_group_add_toggle_actions (shell->priv->generalActions, liferea_shell_feedlist_toggle_entries, G_N_ELEMENTS (liferea_shell_feedlist_toggle_entries), shell->priv);
1103
1079
        gtk_ui_manager_insert_action_group (ui_manager, shell->priv->generalActions, 0);
1104
1080
 
1105
1081
        shell->priv->addActions = gtk_action_group_new ("AddActions");
1106
1082
        gtk_action_group_set_translation_domain (shell->priv->addActions, PACKAGE);
1107
 
        gtk_action_group_add_actions (shell->priv->addActions, ui_mainwindow_add_action_entries, G_N_ELEMENTS (ui_mainwindow_add_action_entries), shell->priv);
 
1083
        gtk_action_group_add_actions (shell->priv->addActions, liferea_shell_add_action_entries, G_N_ELEMENTS (liferea_shell_add_action_entries), shell->priv);
1108
1084
        gtk_ui_manager_insert_action_group (ui_manager, shell->priv->addActions, 0);
1109
1085
 
1110
1086
        shell->priv->feedActions = gtk_action_group_new ("FeedActions");
1111
1087
        gtk_action_group_set_translation_domain (shell->priv->feedActions, PACKAGE);
1112
 
        gtk_action_group_add_actions (shell->priv->feedActions, ui_mainwindow_feed_action_entries, G_N_ELEMENTS (ui_mainwindow_feed_action_entries), shell->priv);
 
1088
        gtk_action_group_add_actions (shell->priv->feedActions, liferea_shell_feed_action_entries, G_N_ELEMENTS (liferea_shell_feed_action_entries), shell->priv);
1113
1089
        gtk_ui_manager_insert_action_group (ui_manager, shell->priv->feedActions, 0);
1114
1090
 
1115
1091
        shell->priv->readWriteActions = gtk_action_group_new("ReadWriteActions");
1116
1092
        gtk_action_group_set_translation_domain (shell->priv->readWriteActions, PACKAGE);
1117
 
        gtk_action_group_add_actions (shell->priv->readWriteActions, ui_mainwindow_read_write_action_entries, G_N_ELEMENTS (ui_mainwindow_read_write_action_entries), shell->priv);
 
1093
        gtk_action_group_add_actions (shell->priv->readWriteActions, liferea_shell_read_write_action_entries, G_N_ELEMENTS (liferea_shell_read_write_action_entries), shell->priv);
1118
1094
        gtk_ui_manager_insert_action_group (ui_manager, shell->priv->readWriteActions, 0);
1119
1095
 
1120
1096
        shell->priv->itemActions = gtk_action_group_new ("ItemActions");
1121
1097
        gtk_action_group_set_translation_domain (shell->priv->itemActions, PACKAGE);
1122
 
        gtk_action_group_add_actions (shell->priv->itemActions, ui_mainwindow_item_action_entries, G_N_ELEMENTS (ui_mainwindow_item_action_entries), shell->priv);
 
1098
        gtk_action_group_add_actions (shell->priv->itemActions, liferea_shell_item_action_entries, G_N_ELEMENTS (liferea_shell_item_action_entries), shell->priv);
1123
1099
        gtk_ui_manager_insert_action_group (ui_manager, shell->priv->itemActions, 0);
1124
1100
 
1125
1101
        accel_group = gtk_ui_manager_get_accel_group (ui_manager);
1128
1104
 
1129
1105
        g_signal_connect (gtk_accel_map_get (), "changed", G_CALLBACK (on_accel_change), NULL);
1130
1106
 
1131
 
        if (!gtk_ui_manager_add_ui_from_string (ui_manager, ui_mainwindow_ui_desc, -1, &error))
 
1107
        if (!gtk_ui_manager_add_ui_from_string (ui_manager, liferea_shell_ui_desc, -1, &error))
1132
1108
                g_error ("building menus failed: %s", error->message);
1133
1109
 
1134
 
        ui_search_engines_setup_menu (ui_manager);
1135
 
 
1136
1110
        shell->priv->menubar = gtk_ui_manager_get_widget (ui_manager, "/MainwindowMenubar");
1137
1111
        shell->priv->toolbar = gtk_ui_manager_get_widget (ui_manager, "/maintoolbar");
1138
1112
 
1187
1161
 
1188
1162
        debug0 (DEBUG_GUI, "Setting up feed list");
1189
1163
        shell->priv->feedlistView = GTK_TREE_VIEW (liferea_shell_lookup ("feedlist"));
1190
 
        ui_feedlist_init (shell->priv->feedlistView);
 
1164
        feed_list_view_init (shell->priv->feedlistView);
1191
1165
 
1192
1166
        /* 6.) setup menu sensivity */
1193
1167
        
1204
1178
        
1205
1179
        debug0 (DEBUG_GUI, "Setting up item view");
1206
1180
 
1207
 
        shell->priv->itemview = itemview_create (ui_itemlist_new (GTK_WIDGET (shell->priv->window)));
 
1181
        shell->priv->itemview = itemview_create (GTK_WIDGET (shell->priv->window));
1208
1182
        
1209
1183
        /* 8.) load icons as required */
1210
1184
        
1211
1185
        debug0 (DEBUG_GUI, "Loading icons");
1212
1186
        
1213
 
        ui_common_add_pixmap_directory (PACKAGE_DATA_DIR G_DIR_SEPARATOR_S PACKAGE G_DIR_SEPARATOR_S "pixmaps");
 
1187
        icons_load ();
1214
1188
        
1215
 
        /* first try to load icons from theme */
1216
 
        static const gchar *iconThemeNames[] = {
1217
 
                NULL,                   /* ICON_READ */
1218
 
                NULL,                   /* ICON_UNREAD */
1219
 
                "emblem-important",     /* ICON_FLAG */
1220
 
                NULL,                   /* ICON_AVAILABLE */
1221
 
                NULL,                   /* ICON_AVAILABLE_OFFLINE */
1222
 
                NULL,                   /* ICON_UNAVAILABLE */
1223
 
                NULL,                   /* ICON_DEFAULT */
1224
 
                NULL,                   /* ICON_FOLDER_EMPTY */
1225
 
                "folder",               /* ICON_FOLDER */
1226
 
                "folder-saved-search",  /* ICON_VFOLDER */
1227
 
                NULL,                   /* ICON_NEWSBIN */
1228
 
                NULL,                   /* ICON_EMPTY */
1229
 
                NULL,                   /* ICON_EMPTY_OFFLINE */
1230
 
                "gtk-connect",          /* ICON_ONLINE */
1231
 
                "gtk-disconnect",       /* ICON_OFFLINE */
1232
 
                NULL,                   /* ICON_UPDATED */
1233
 
                "mail-attachment",      /* ICON_ENCLOSURE */
1234
 
                NULL
1235
 
        };
1236
 
 
1237
 
        icon_theme = gtk_icon_theme_get_default ();
1238
 
        for (i = 0; i < MAX_ICONS; i++)
1239
 
                if (iconThemeNames[i])
1240
 
                        icons[i] = liferea_shell_get_theme_icon (icon_theme, iconThemeNames[i], 16);
1241
 
 
1242
 
        /* and then load own default icons */
1243
 
        static const gchar *iconNames[] = {
1244
 
                "read.xpm",             /* ICON_READ */
1245
 
                "unread.png",           /* ICON_UNREAD */
1246
 
                "flag.png",             /* ICON_FLAG */
1247
 
                "available.png",        /* ICON_AVAILABLE */
1248
 
                "available_offline.png",        /* ICON_AVAILABLE_OFFLINE */
1249
 
                NULL,                   /* ICON_UNAVAILABLE */
1250
 
                "default.png",          /* ICON_DEFAULT */
1251
 
                "folder_empty.png",     /* ICON_FOLDER_EMPTY */
1252
 
                "directory.png",        /* ICON_FOLDER */
1253
 
                "vfolder.png",          /* ICON_VFOLDER */
1254
 
                "newsbin.png",          /* ICON_NEWSBIN */
1255
 
                "empty.png",            /* ICON_EMPTY */
1256
 
                "empty_offline.png",    /* ICON_EMPTY_OFFLINE */
1257
 
                "online.png",           /* ICON_ONLINE */
1258
 
                "offline.png",          /* ICON_OFFLINE */
1259
 
                "edit.png",             /* ICON_UPDATED */
1260
 
                "attachment.png",       /* ICON_ENCLOSURE */
1261
 
                NULL
1262
 
        };
1263
 
 
1264
 
        for (i = 0; i < MAX_ICONS; i++)
1265
 
                if (!icons[i])
1266
 
                        icons[i] = ui_common_create_pixbuf (iconNames[i]);
1267
 
 
1268
 
        /* set up icons that are build from stock */
1269
 
        widget = gtk_button_new ();
1270
 
        icons[ICON_UNAVAILABLE] = gtk_widget_render_icon (widget, GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_MENU, "");
1271
 
        gtk_widget_destroy (widget);
 
1189
        /* 9.) update all menu elements */
1272
1190
        
1273
1191
        liferea_shell_update_toolbar ();
1274
 
        liferea_shell_online_status_changed (network_is_online ());
1275
1192
        
1276
 
        liferea_shell_setup_URL_receiver (GTK_WIDGET (shell->priv->window));    /* setup URL dropping support */
 
1193
        liferea_shell_setup_URL_receiver ();    /* setup URL dropping support */
1277
1194
 
1278
1195
        shell->priv->feedlist = feedlist_create ();
1279
 
        
1280
 
        ui_tray_enable (conf_get_bool_value (SHOW_TRAY_ICON));          /* init tray icon */
1281
 
        
1282
 
        ui_indicator_init ();
 
1196
 
 
1197
        conf_get_bool_value (SHOW_TRAY_ICON, &show_tray_icon);
 
1198
 
 
1199
        ui_tray_enable (show_tray_icon);                /* init tray icon */
1283
1200
 
1284
1201
        liferea_shell_restore_state ();
1285
1202
        
1293
1210
                /* Needed so that the window structure can be
1294
1211
                   accessed... otherwise will GTK warning when window is
1295
1212
                   shown by clicking on notification icon. */
1296
 
                // gtk_widget_realize (GTK_WIDGET (shell->priv->window));
1297
 
                // Does not work with gtkmozembed...
1298
 
                
 
1213
                   
 
1214
                /* Note: gtk_widget_realize () did not work with GtkMozEmbed
 
1215
                   therefore we use show+hide instead. */
1299
1216
                gtk_widget_show (GTK_WIDGET (shell->priv->window));
1300
1217
                gtk_widget_hide (GTK_WIDGET (shell->priv->window));
1301
1218
        }
1307
1224
        /* force two pane mode */
1308
1225
        /*   For some reason, this causes the first item to be selected and then
1309
1226
             unselected... strange. */
1310
 
        ui_feedlist_select (NULL);
 
1227
        feed_list_view_select (NULL);
1311
1228
        
1312
1229
        itemview_set_layout (NODE_VIEW_MODE_COMBINED);
1313
1230
        
1325
1242
        g_string_append (buffer,   "</h3></td></tr><tr><td colspan=\"2\">");
1326
1243
        g_string_append (buffer,   _("<p>Welcome to <b>Liferea</b>, a desktop news aggregator for online news "
1327
1244
                                   "feeds.</p>"
1328
 
                                   "<p>The left pane contains the list of your subscriptions. To add a "
1329
 
                                   "subscription select Feeds -&gt; New Subscription. To browse the headlines "
1330
 
                                   "of a feed select it in the feed list and the headlines will be loaded "
1331
 
                                   "into the right pane.</p>"));
 
1245
                                   "<p>You can add new subscriptions "
 
1246
                                   "<ul>"
 
1247
                                   "<li>From main menu 'Subscription' -&gt; 'New Subscription'</li>"
 
1248
                                   "<li>By dropping feed links into the subscription list</li>"
 
1249
                                   "<li>By right clicking links and choosing 'Subscribe' within Liferea</li>"
 
1250
                                   "</ul>"
 
1251
                                   "</p>"));
1332
1252
        g_string_append (buffer,   "</td></tr></table>");
1333
 
 
 
1253
        
1334
1254
        g_string_append (buffer,   "</div>");
1335
1255
 
1336
1256
        htmlview_finish_output (buffer);
1337
1257
        itemview_display_info (buffer->str);
1338
1258
        g_string_free (buffer, TRUE);
1339
1259
        
 
1260
        /* 10. Connect network monitoring and set icon*/
 
1261
        
 
1262
        g_signal_connect (network_monitor_get (), "online-status-changed",
 
1263
                          G_CALLBACK (liferea_shell_online_status_changed), shell);
 
1264
 
 
1265
        liferea_shell_set_online_icon (network_monitor_is_online ());
 
1266
 
1340
1267
        debug_exit ("liferea_shell_create");
1341
1268
}
1342
1269
 
1343
1270
void
1344
1271
liferea_shell_destroy (void)
1345
1272
{
1346
 
        ui_feedlist_select (NULL);
 
1273
        feed_list_view_select (NULL);
1347
1274
        liferea_shell_save_position ();
1348
 
        ui_indicator_destroy ();
1349
1275
        ui_tray_enable (FALSE);
1350
 
        notification_enable (FALSE);
1351
1276
        g_object_unref (shell->priv->tabs);
1352
1277
        g_object_unref (shell->priv->feedlist);
 
1278
        g_object_unref (shell->priv->itemview);
1353
1279
 
1354
1280
        gtk_widget_destroy (GTK_WIDGET (shell->priv->window));
 
1281
 
 
1282
        g_object_unref (shell);
1355
1283
}
1356
1284
 
1357
1285
void
1359
1287
{
1360
1288
        GtkWidget *mainwindow = GTK_WIDGET (shell->priv->window);
1361
1289
        
1362
 
        if ((gdk_window_get_state (mainwindow->window) & GDK_WINDOW_STATE_ICONIFIED) || !GTK_WIDGET_VISIBLE (mainwindow))
 
1290
        if ((gdk_window_get_state (gtk_widget_get_window (mainwindow)) & GDK_WINDOW_STATE_ICONIFIED) || !gtk_widget_get_visible (mainwindow))
1363
1291
                liferea_shell_restore_position ();
1364
1292
 
1365
1293
        gtk_window_present (shell->priv->window);
1366
 
        gdk_window_raise (gtk_widget_get_window (mainwindow));
1367
1294
}
1368
1295
 
1369
1296
void
1371
1298
{
1372
1299
        GtkWidget *mainwindow = GTK_WIDGET (shell->priv->window);
1373
1300
        
1374
 
        if(gdk_window_get_state(GTK_WIDGET(mainwindow)->window) & GDK_WINDOW_STATE_ICONIFIED) {
 
1301
        if (gdk_window_get_state (gtk_widget_get_window (mainwindow)) & GDK_WINDOW_STATE_ICONIFIED) {
1375
1302
                /* The window is either iconified, or on another workspace */
1376
1303
                /* Raise it in one click */
1377
 
                if (GTK_WIDGET_VISIBLE(mainwindow)) {
 
1304
                if (gtk_widget_get_visible (mainwindow)) {
1378
1305
                        liferea_shell_save_position ();
1379
 
                        gtk_widget_hide(mainwindow);
 
1306
                        gtk_widget_hide (mainwindow);
1380
1307
                }
1381
 
                liferea_shell_restore_position();
1382
 
                gtk_window_present(GTK_WINDOW(mainwindow));
 
1308
                liferea_shell_restore_position ();
 
1309
                /* Note: Without deiconify() desktop moving doesn't work in 
 
1310
                   GNOME+metacity. The window would be moved correctly by 
 
1311
                   present() but not become visible. */
 
1312
                gtk_window_deiconify (GTK_WINDOW (mainwindow));
 
1313
                gtk_window_present (GTK_WINDOW (mainwindow));
1383
1314
        }
1384
 
        else if(!GTK_WIDGET_VISIBLE(mainwindow)) {
 
1315
        else if (!gtk_widget_get_visible (mainwindow)) {
1385
1316
                /* The window is neither iconified nor on another workspace, but is not visible */
1386
1317
                liferea_shell_restore_position ();
1387
1318
                gtk_window_present (shell->priv->window);
1397
1328
        return GTK_WIDGET (shell->priv->window);
1398
1329
}
1399
1330
 
1400
 
void liferea_shell_set_view_mode (nodeViewType newMode)
 
1331
void
 
1332
liferea_shell_set_view_mode (nodeViewType newMode)
1401
1333
{
1402
1334
        GtkRadioAction       *action;
1403
1335