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

« back to all changes in this revision

Viewing changes to src/ui/search_folder_dialog.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:
1
1
/**
2
2
 * @file search-folder-dialog.c  Search folder properties dialog
3
3
 *
4
 
 * Copyright (C) 2007-2008 Lars Lindner <lars.lindner@gmail.com>
 
4
 * Copyright (C) 2007-2011 Lars Lindner <lars.lindner@gmail.com>
5
5
 *
6
6
 * This program is free software; you can redistribute it and/or modify
7
7
 * it under the terms of the GNU General Public License as published by
23
23
#include "feedlist.h"
24
24
#include "itemlist.h"
25
25
#include "vfolder.h"
 
26
#include "ui/itemview.h"
26
27
#include "ui/liferea_dialog.h"
27
28
#include "ui/liferea_shell.h"
28
29
#include "ui/rule_editor.h"
29
 
#include "ui/ui_itemlist.h"
30
30
#include "ui/ui_node.h"
31
31
 
32
 
static void search_folder_dialog_class_init     (SearchFolderDialogClass *klass);
33
 
static void search_folder_dialog_init           (SearchFolderDialog *ld);
34
 
 
35
32
#define SEARCH_FOLDER_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), SEARCH_FOLDER_DIALOG_TYPE, SearchFolderDialogPrivate))
36
33
 
37
34
struct SearchFolderDialogPrivate {
43
40
 
44
41
static GObjectClass *parent_class = NULL;
45
42
 
46
 
GType
47
 
search_folder_dialog_get_type (void) 
48
 
{
49
 
        static GType type = 0;
50
 
 
51
 
        if (G_UNLIKELY (type == 0)) 
52
 
        {
53
 
                static const GTypeInfo our_info = 
54
 
                {
55
 
                        sizeof (SearchFolderDialogClass),
56
 
                        NULL, /* base_init */
57
 
                        NULL, /* base_finalize */
58
 
                        (GClassInitFunc) search_folder_dialog_class_init,
59
 
                        NULL,
60
 
                        NULL, /* class_data */
61
 
                        sizeof (SearchFolderDialog),
62
 
                        0, /* n_preallocs */
63
 
                        (GInstanceInitFunc) search_folder_dialog_init
64
 
                };
65
 
 
66
 
                type = g_type_register_static (G_TYPE_OBJECT,
67
 
                                               "SearchFolderDialog",
68
 
                                               &our_info, 0);
69
 
        }
70
 
 
71
 
        return type;
72
 
}
 
43
G_DEFINE_TYPE (SearchFolderDialog, search_folder_dialog, G_TYPE_OBJECT);
73
44
 
74
45
static void
75
46
search_folder_dialog_finalize (GObject *object)
107
78
        if (response_id == GTK_RESPONSE_OK) {   
108
79
                /* save new search folder settings */
109
80
                node_set_title (sfd->priv->node, gtk_entry_get_text (GTK_ENTRY (sfd->priv->nameEntry)));
110
 
                rule_editor_save (sfd->priv->re, sfd->priv->vfolder);
111
 
                sfd->priv->vfolder->anyMatch = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (liferea_dialog_lookup (GTK_WIDGET (dialog), "anyRuleRadioBtn")));
 
81
                rule_editor_save (sfd->priv->re, sfd->priv->vfolder->itemset);
 
82
                sfd->priv->vfolder->itemset->anyMatch = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (liferea_dialog_lookup (GTK_WIDGET (dialog), "anyRuleRadioBtn")));
112
83
 
113
84
                /* update search folder */
114
 
                ui_itemlist_clear ();
115
 
                vfolder_refresh (sfd->priv->vfolder);
 
85
                itemview_clear ();
 
86
                vfolder_reset (sfd->priv->vfolder);
116
87
                itemlist_unload (FALSE);
117
88
                
118
89
                /* If we are finished editing a new search folder add it to the feed list */
120
91
                        feedlist_node_added (sfd->priv->node);
121
92
                        
122
93
                ui_node_update (sfd->priv->node->id);
123
 
        } else if (response_id == GTK_RESPONSE_CANCEL) {
124
 
                /* Only destroy temporary nodes */
125
 
                if (!sfd->priv->node->parent)
126
 
                        node_free(sfd->priv->node);
127
94
        }
128
95
        
129
96
        gtk_widget_destroy (GTK_WIDGET (dialog));
145
112
        SearchFolderDialog      *sfd;
146
113
        
147
114
        sfd = SEARCH_FOLDER_DIALOG (g_object_new (SEARCH_FOLDER_DIALOG_TYPE, NULL));
148
 
        sfd->priv->re = rule_editor_new ((vfolderPtr)node->data);
149
115
        sfd->priv->node = node;
150
116
        sfd->priv->vfolder = (vfolderPtr)node->data;
 
117
        sfd->priv->re = rule_editor_new (sfd->priv->vfolder->itemset);
151
118
        
152
119
        /* Create the dialog */
153
120
        dialog = liferea_dialog_new (NULL, "vfolderdialog");
157
124
        gtk_entry_set_text (GTK_ENTRY (sfd->priv->nameEntry), node_get_title (node));
158
125
        
159
126
        /* Set up rule match type */
160
 
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (liferea_dialog_lookup (dialog, sfd->priv->vfolder->anyMatch?"anyRuleRadioBtn":"allRuleRadioBtn")), TRUE);
 
127
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (liferea_dialog_lookup (dialog, sfd->priv->vfolder->itemset->anyMatch?"anyRuleRadioBtn":"allRuleRadioBtn")), TRUE);
161
128
        
162
129
        /* Set up rule list vbox */
163
130
        gtk_container_add (GTK_CONTAINER (liferea_dialog_lookup (dialog, "ruleview_vfolder_dialog")), rule_editor_get_widget (sfd->priv->re));