summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--logview/data/logview-filter.ui356
-rw-r--r--logview/src/logview-filter-manager.c80
2 files changed, 235 insertions, 201 deletions
diff --git a/logview/data/logview-filter.ui b/logview/data/logview-filter.ui
index 57e8cb59..55fc65c5 100644
--- a/logview/data/logview-filter.ui
+++ b/logview/data/logview-filter.ui
@@ -1,198 +1,298 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
<interface>
- <requires lib="gtk+" version="2.16"/>
- <!-- interface-naming-policy project-wide -->
+ <requires lib="gtk+" version="3.22"/>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">process-stop</property>
+ </object>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">gtk-apply</property>
+ </object>
<object class="GtkDialog" id="dialog_filter">
- <property name="border_width">5</property>
- <property name="modal">True</property>
- <property name="type_hint">normal</property>
+ <property name="can_focus">False</property>
+ <property name="type_hint">dialog</property>
+ <child>
+ <placeholder/>
+ </child>
<child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox2">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkTable" id="table1">
- <property name="visible">True</property>
- <property name="n_rows">3</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">12</property>
- <property name="row_spacing">6</property>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Name:</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
+ <object class="GtkBox">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
<child>
- <object class="GtkLabel" id="label2">
+ <object class="GtkButton" id="button1">
+ <property name="label" translatable="yes">_Cancel</property>
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Regular Expression:</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image1</property>
<property name="use_underline">True</property>
+ <property name="always_show_image">True</property>
</object>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkEntry" id="entry_name">
+ <object class="GtkButton" id="button2">
+ <property name="label" translatable="yes">_Apply</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image2</property>
+ <property name="use_underline">True</property>
+ <property name="always_show_image">True</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
</packing>
</child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">12</property>
+ <property name="margin_right">12</property>
+ <property name="margin_top">12</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
<child>
- <object class="GtkEntry" id="entry_regex">
+ <object class="GtkGrid">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label_name">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">_Name:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">entry_name</property>
+ <accessibility>
+ <relation type="label-for" target="entry_name"/>
+ </accessibility>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_regex">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">_Regular Expression:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">entry_regex</property>
+ <accessibility>
+ <relation type="label-for" target="entry_regex"/>
+ </accessibility>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry_name">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <accessibility>
+ <relation type="labelled-by" target="label_name"/>
+ </accessibility>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry_regex">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <accessibility>
+ <relation type="labelled-by" target="label_regex"/>
+ </accessibility>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkFrame" id="frame1">
+ <object class="GtkFrame">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label_xalign">0</property>
- <property name="label_yalign">0</property>
<property name="shadow_type">none</property>
<child>
- <object class="GtkAlignment" id="alignment1">
+ <object class="GtkAlignment">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
- <object class="GtkTable" id="table2">
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">12</property>
- <property name="row_spacing">12</property>
+ <property name="can_focus">False</property>
+ <property name="margin_top">6</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
<child>
- <object class="GtkRadioButton" id="radio_color">
- <property name="label" translatable="yes">Highlight</property>
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="xalign">0</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- </object>
- </child>
- <child>
- <object class="GtkRadioButton" id="radio_visible">
- <property name="label" translatable="yes">Hide</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="xalign">0</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="vbox_color">
- <property name="visible">True</property>
- <property name="spacing">5</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkRadioButton" id="radio_color">
+ <property name="label" translatable="yes">Highlight</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="halign">start</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
- <object class="GtkHBox" id="hbox1">
+ <object class="GtkGrid" id="vbox_color">
+ <property name="sensitive" bind-source="radio_color" bind-property="active"/>
<property name="visible">True</property>
- <property name="spacing">12</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">12</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
<child>
<object class="GtkCheckButton" id="check_foreground">
+ <property name="active">True</property>
<property name="label" translatable="yes">Foreground:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="xalign">0</property>
+ <property name="halign">start</property>
<property name="draw_indicator">True</property>
</object>
<packing>
- <property name="position">0</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
- <object class="GtkColorButton" id="color_foreground">
+ <object class="GtkCheckButton" id="check_background">
+ <property name="active">True</property>
+ <property name="label" translatable="yes">Background:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="halign">start</property>
+ <property name="draw_indicator">True</property>
</object>
<packing>
- <property name="position">1</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
</packing>
</child>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <property name="spacing">12</property>
<child>
- <object class="GtkCheckButton" id="check_background">
- <property name="label" translatable="yes">Background:</property>
+ <object class="GtkColorButton" id="color_foreground">
+ <property name="sensitive" bind-source="check_foreground" bind-property="active"/>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
+ <property name="receives_default">True</property>
+ <property name="rgba">rgb(238,238,236)</property>
</object>
<packing>
- <property name="position">0</property>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="color_background">
+ <property name="sensitive" bind-source="check_background" bind-property="active"/>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <property name="rgba">rgb(164,0,0)</property>
</object>
<packing>
- <property name="position">1</property>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <placeholder/>
+ <object class="GtkRadioButton" id="radio_visible">
+ <property name="label" translatable="yes">Hide</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="halign">start</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radio_color</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
- <object class="GtkLabel" id="label3">
+ <object class="GtkLabel">
<property name="visible">True</property>
- <property name="xalign">0</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">Effect:</property>
<attributes>
<attribute name="weight" value="bold"/>
@@ -201,49 +301,15 @@
</child>
</object>
<packing>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_padding">6</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area2">
- <property name="visible">True</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="button1">
- <property name="label">gtk-cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button2">
- <property name="label">gtk-apply</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="pack_type">end</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
diff --git a/logview/src/logview-filter-manager.c b/logview/src/logview-filter-manager.c
index 299a5a53..d411029d 100644
--- a/logview/src/logview-filter-manager.c
+++ b/logview/src/logview-filter-manager.c
@@ -157,13 +157,6 @@ check_regex (LogviewFilterManager *manager, const gchar *regex)
}
static void
-on_check_toggled (GtkToggleButton *button, GtkWidget *widget)
-{
- gtk_widget_set_sensitive (widget,
- gtk_toggle_button_get_active (button));
-}
-
-static void
on_dialog_add_edit_reponse (GtkWidget *dialog, int response_id,
LogviewFilterManager *manager)
{
@@ -201,24 +194,6 @@ on_dialog_add_edit_reponse (GtkWidget *dialog, int response_id,
tag = gtk_text_tag_new (name);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio_color))) {
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_foreground))) {
- GdkRGBA foreground_color;
- gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (color_foreground),
- &foreground_color);
- g_object_set (G_OBJECT (tag),
- "foreground-rgba", &foreground_color,
- "foreground-set", TRUE, NULL);
- }
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_background))) {
- GdkRGBA background_color;
- gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (color_background),
- &background_color);
- g_object_set (tag,
- "paragraph-background-rgba", &background_color,
- "paragraph-background-set", TRUE, NULL);
- }
-
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_foreground))
&& !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_background))) {
GtkWidget *error_dialog;
@@ -236,6 +211,19 @@ on_dialog_add_edit_reponse (GtkWidget *dialog, int response_id,
return;
}
+
+ GdkRGBA foreground_color, background_color;
+
+ gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (color_foreground), &foreground_color);
+ g_object_set (G_OBJECT (tag),
+ "foreground-rgba", &foreground_color,
+ "foreground-set", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_foreground)),
+ NULL);
+ gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (color_background), &background_color);
+ g_object_set (tag,
+ "paragraph-background-rgba", &background_color,
+ "paragraph-background-set", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_background)),
+ NULL);
} else { /* !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio_color)) */
g_object_set (tag, "invisible", TRUE, NULL);
}
@@ -264,7 +252,7 @@ run_add_edit_dialog (LogviewFilterManager *manager, LogviewFilter *filter)
const gchar *title;
GtkWidget *dialog, *entry_name, *entry_regex, *radio_color;
GtkWidget *radio_visible, *check_foreground, *check_background;
- GtkWidget *color_foreground, *color_background, *vbox_color;
+ GtkWidget *color_foreground, *color_background;
gboolean foreground_set, background_set, invisible;
GtkTextTag *tag;
GtkBuilder* builder;
@@ -289,65 +277,45 @@ run_add_edit_dialog (LogviewFilterManager *manager, LogviewFilter *filter)
check_background = GET_WIDGET ("check_background");
color_foreground = GET_WIDGET ("color_foreground");
color_background = GET_WIDGET ("color_background");
- vbox_color = GET_WIDGET ("vbox_color");
title = (filter != NULL ? _("Edit filter") : _("Add new filter"));
gtk_window_set_title (GTK_WINDOW (dialog), title);
- gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_color),
- gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_visible)));
-
- g_signal_connect (check_foreground, "toggled", G_CALLBACK (on_check_toggled),
- color_foreground);
- g_signal_connect (check_background, "toggled", G_CALLBACK (on_check_toggled),
- color_background);
-
- on_check_toggled (GTK_TOGGLE_BUTTON (check_foreground),
- color_foreground);
- on_check_toggled (GTK_TOGGLE_BUTTON (check_background),
- color_background);
-
- g_signal_connect (radio_color, "toggled", G_CALLBACK (on_check_toggled),
- vbox_color);
- on_check_toggled (GTK_TOGGLE_BUTTON (radio_color),
- vbox_color);
-
if (filter) {
+ GdkRGBA *foreground, *background;
+
g_object_get (filter,
"name", &name,
"regex", &regex,
"texttag", &tag,
NULL);
+
g_object_get (tag,
"foreground-set", &foreground_set,
"paragraph-background-set", &background_set,
- "invisible", &invisible, NULL);
+ "invisible", &invisible,
+ NULL);
+
gtk_entry_set_text (GTK_ENTRY(entry_name), name);
gtk_entry_set_text (GTK_ENTRY(entry_regex), regex);
if (foreground_set) {
- GdkRGBA *foreground;
-
g_object_get (tag, "foreground-rgba", &foreground, NULL);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (color_foreground),
foreground);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_foreground),
- TRUE);
-
gdk_rgba_free (foreground);
}
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_foreground),
+ foreground_set);
if (background_set) {
- GdkRGBA *background;
-
g_object_get (tag, "paragraph-background-rgba", &background, NULL);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (color_background),
background);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_background),
- TRUE);
-
gdk_rgba_free (background);
}
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_background),
+ background_set);
if (background_set || foreground_set) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_color), TRUE);