~ubuntu-branches/ubuntu/trusty/bluefish/trusty

« back to all changes in this revision

Viewing changes to src/plugin_htmlbar/prefs.c

  • Committer: Package Import Robot
  • Author(s): Daniel Leidert
  • Date: 2012-06-27 22:28:39 UTC
  • mfrom: (1.2.9)
  • Revision ID: package-import@ubuntu.com-20120627222839-5g0f5s6gpaezfhve
Tags: 2.2.3-1
* New upstream release.
* debian/control: Dropped DM-Upload-Allowed.
  (Maintainer): Set to my new address.
  (Suggests): Calculate browsers depending on distribution.
  (Depends): Added python depends for newly shipped Python scripts.
* debian/copyright: Minor update. Link to GPLv2 text.
* debian/rules: Enabled hardening. Added python2 module. Calculate brwoser
  dependencies via dpkg-vendor.
* debian/patches/LP810663_blacklist_from_appmenu.patch: Adjusted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#include "htmlbar.h"
 
3
#include "../preferences.h"
 
4
#include "../gtk_easy.h"
 
5
#include "../dialog_utils.h"
 
6
 
 
7
typedef struct {
 
8
        GtkWidget *in_sidepanel;
 
9
        GtkWidget *transient_htdialogs;
 
10
        GtkWidget *lowercase_tags;
 
11
        GtkWidget *allow_dep;
 
12
        GtkWidget *format_by_context;
 
13
        GtkWidget *xhtml;
 
14
        GtkWidget *auto_update_meta_author;
 
15
        GtkWidget *auto_update_meta_date;
 
16
        GtkWidget *auto_update_meta_generator;
 
17
} Thtmlbarprefs;
 
18
 
 
19
Thtmlbarprefs *hbp = NULL;
 
20
 
 
21
void htmlbar_pref_apply()
 
22
{
 
23
        /*g_print("htmlbar_pref_apply\n");*/
 
24
        integer_apply(&htmlbar_v.in_sidepanel, hbp->in_sidepanel, TRUE);
 
25
        integer_apply(&htmlbar_v.transient_htdialogs, hbp->transient_htdialogs, TRUE);  
 
26
        integer_apply(&main_v->props.xhtml, hbp->xhtml, TRUE);
 
27
        if (main_v->props.xhtml) {
 
28
                htmlbar_v.lowercase_tags = 1;
 
29
                main_v->props.allow_dep = 0;
 
30
        } else {
 
31
                integer_apply(&htmlbar_v.lowercase_tags, hbp->lowercase_tags, TRUE);
 
32
                integer_apply(&main_v->props.allow_dep, hbp->allow_dep, TRUE);
 
33
        }
 
34
        integer_apply(&main_v->props.format_by_context, hbp->format_by_context, TRUE);
 
35
 
 
36
        integer_apply(&main_v->props.auto_update_meta_author, hbp->auto_update_meta_author, TRUE);
 
37
        integer_apply(&main_v->props.auto_update_meta_date, hbp->auto_update_meta_date, TRUE);
 
38
        integer_apply(&main_v->props.auto_update_meta_generator, hbp->auto_update_meta_generator, TRUE);
 
39
}
 
40
 
 
41
static void
 
42
xhtml_toggled_lcb(GtkWidget * widget,  Thtmlbarprefs* hbp)
 
43
{
 
44
        gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
45
        gtk_widget_set_sensitive(hbp->lowercase_tags, !active);
 
46
        gtk_widget_set_sensitive(hbp->allow_dep, !active);
 
47
}
 
48
 
 
49
void htmlbar_pref_initgui(GtkTreeStore *nstore, GtkTreeIter *pit, GSList **widgetfreelist)
 
50
{
 
51
        GtkWidget *frame, *vbox, *table, *vbox2;
 
52
        GtkTreeIter it;
 
53
        
 
54
        hbp = g_new0(Thtmlbarprefs, 1);
 
55
        
 
56
        frame = gtk_frame_new(NULL);
 
57
        gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
 
58
        vbox = gtk_vbox_new(FALSE, 12);
 
59
        gtk_container_set_border_width(GTK_CONTAINER(vbox), 6);
 
60
        gtk_container_add(GTK_CONTAINER(frame), vbox);
 
61
        
 
62
        gtk_tree_store_append(nstore, &it, pit);
 
63
        gtk_tree_store_set(nstore, &it, NAMECOL, _("HTML Features"), WIDGETCOL, frame, -1);
 
64
        *widgetfreelist = g_slist_prepend(*widgetfreelist, frame);
 
65
 
 
66
        vbox2 = dialog_vbox_labeled(_("<b>HTML Toolbar</b>"), vbox);
 
67
        table = dialog_table_in_vbox_defaults(2, 1, 0, vbox2);
 
68
        hbp->in_sidepanel =
 
69
                dialog_check_button_in_table(_("Show toolbar in sidepanel"), htmlbar_v.in_sidepanel, table, 0, 1, 0,1);
 
70
        hbp->transient_htdialogs = dialog_check_button_in_table(_("Keep HTML dialogs always on top"),
 
71
                                                                                                                         htmlbar_v.transient_htdialogs, table, 0, 1, 1, 2);
 
72
        
 
73
        
 
74
        
 
75
        vbox2 = dialog_vbox_labeled(_("<b>HTML options</b>"), vbox);
 
76
        table = dialog_table_in_vbox_defaults(4, 1, 0, vbox2);
 
77
 
 
78
        hbp->xhtml =
 
79
                dialog_check_button_in_table(_("Use _XHTML style tags (<br />)"), main_v->props.xhtml, table, 0, 1, 0,1);
 
80
        g_signal_connect(G_OBJECT(hbp->xhtml), "toggled", G_CALLBACK(xhtml_toggled_lcb), hbp);
 
81
        hbp->lowercase_tags = dialog_check_button_in_table(_("Use lo_wercase HTML tags"),
 
82
                                                                                                                         htmlbar_v.lowercase_tags, table, 0, 1, 1, 2);
 
83
        hbp->allow_dep = dialog_check_button_in_table(_("Use de_precated tags (e.g. <font> and <nobr>)"),
 
84
                                                                                                                main_v->props.allow_dep, table, 0, 1, 2, 3);
 
85
        hbp->format_by_context =
 
86
                dialog_check_button_in_table(_
 
87
                                                                         ("_Format according to accessibility guidelines (e.g. <strong> for <b>)"),
 
88
                                                                         main_v->props.format_by_context, table, 0, 1, 3, 4);
 
89
 
 
90
        xhtml_toggled_lcb(hbp->xhtml, hbp);
 
91
 
 
92
        vbox2 = dialog_vbox_labeled(_("<b>Auto Update Tag Options</b>"), vbox);
 
93
        table = dialog_table_in_vbox_defaults(3, 1, 0, vbox2);
 
94
 
 
95
        hbp->auto_update_meta_author =
 
96
                dialog_check_button_in_table(_("Automatically update a_uthor meta tag"),
 
97
                                                                         main_v->props.auto_update_meta_author, table, 0, 1, 0, 1);
 
98
        hbp->auto_update_meta_date =
 
99
                dialog_check_button_in_table(_("Automatically update _date meta tag"),
 
100
                                                                         main_v->props.auto_update_meta_date, table, 0, 1, 1, 2);
 
101
        hbp->auto_update_meta_generator =
 
102
                dialog_check_button_in_table(_("Automatically update _generator meta tag"),
 
103
                                                                         main_v->props.auto_update_meta_generator, table, 0, 1, 2, 3);
 
104
 
 
105
}