summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2011-04-14 13:37:06 +0200
committerDenys Vlasenko <dvlasenk@redhat.com>2011-04-14 13:37:06 +0200
commit5fc071f674e27e99fca24be9377c68b8ad9a3047 (patch)
tree15207159fe8a536f5f016c798fda10090f661a34 /src
parent728c8a11a94ef3c88ed20aa7ea7ccccb045405b1 (diff)
downloadabrt-5fc071f674e27e99fca24be9377c68b8ad9a3047.tar.gz
abrt-5fc071f674e27e99fca24be9377c68b8ad9a3047.tar.xz
abrt-5fc071f674e27e99fca24be9377c68b8ad9a3047.zip
Revert last commit
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/gtk-helpers/Makefile.am7
-rw-r--r--src/gtk-helpers/autowrapped_label.c74
-rw-r--r--src/gtk-helpers/libreport-gtk.h2
-rw-r--r--src/gui-wizard-gtk/wizard.c75
4 files changed, 30 insertions, 128 deletions
diff --git a/src/gtk-helpers/Makefile.am b/src/gtk-helpers/Makefile.am
index d60df6d5..90c9be7f 100644
--- a/src/gtk-helpers/Makefile.am
+++ b/src/gtk-helpers/Makefile.am
@@ -3,10 +3,9 @@ lib_LTLIBRARIES = \
libreportgtk.la
libreportgtk_la_SOURCES = \
- libreport-gtk.h \
- event_config_dialog.c \
- abrt-keyring.c \
- autowrapped_label.c
+ libreport-gtk.h \
+ event_config_dialog.c \
+ abrt-keyring.c
libreportgtk_la_CPPFLAGS = \
-Wall -Wwrite-strings -Werror \
diff --git a/src/gtk-helpers/autowrapped_label.c b/src/gtk-helpers/autowrapped_label.c
deleted file mode 100644
index 01d8856b..00000000
--- a/src/gtk-helpers/autowrapped_label.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- Copyright (C) 2011 ABRT Team
- Copyright (C) 2011 RedHat inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- 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.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-#include <gtk/gtk.h>
-#include "abrtlib.h"
-
-/*
- * GTK doesn't re-wrap GtkLabels which have line wrapping set to true.
- * The line wrapped label in VBox looks like this:
- * |----------------------------------------|
- * |----------------------------------------|
- * | word word word word |
- * | word word word word |
- * | word word |
- * |----------------------------------------|
- * |----------------------------------------|
- * So every project copy-pastes this code to make labels widen
- * and shrink horizontally on resize.
- */
-
-static void rewrap_label_to_parent_size(GtkWidget *widget,
- GtkAllocation *allocation,
- gpointer data)
-{
- GtkLabel *label = GTK_LABEL(widget);
- PangoLayout *layout = gtk_label_get_layout(label);
-
- int lw_old, lh_old;
- pango_layout_get_pixel_size(layout, &lw_old, &lh_old);
-
- /* Already right size? */
- if (lw_old == allocation->width)
- return;
-
- /* Rewrap text to new width */
- pango_layout_set_width(layout, allocation->width * PANGO_SCALE);
-
- /* Did text height change as a result? */
- int lh;
- pango_layout_get_pixel_size(layout, NULL, &lh);
- if (lh != lh_old) /* yes, resize label height */
- gtk_widget_set_size_request(widget, -1, lh);
-}
-
-void make_label_autowrap_on_resize(GtkLabel *label)
-{
- // So far, only tested to work on labels which were set up as:
- //gtk_label_set_justify(label, GTK_JUSTIFY_LEFT);
- //gtk_misc_set_alignment(GTK_MISC(label), /*xalign:*/ 0.0, /*yalign:*/ 0.0);
-
- /* Makes no sense on non-wrapped labels, so we can as well
- * set wrapping to "on" unconditionally, istead of making it a requirement
- */
- gtk_label_set_line_wrap(label, TRUE);
- g_signal_connect(G_OBJECT(label), "size-allocate", G_CALLBACK(rewrap_label_to_parent_size), NULL);
-
- // So far, only tested to work on labels which were set up as:
- //gtk_box_pack_start(box, label, /*expand*/ false, /*fill*/ false, /*padding*/ 0);
-}
diff --git a/src/gtk-helpers/libreport-gtk.h b/src/gtk-helpers/libreport-gtk.h
index d2105c3a..e7cf4824 100644
--- a/src/gtk-helpers/libreport-gtk.h
+++ b/src/gtk-helpers/libreport-gtk.h
@@ -17,7 +17,5 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
void show_events_list_dialog(GtkWindow *parent);
-void make_label_autowrap_on_resize(GtkLabel *label);
-
void abrt_keyring_save_settings(const char *event_name);
void load_event_config_data_from_keyring();
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 6bef08d3..04200fc6 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -381,17 +381,14 @@ static void report_tb_was_toggled(GtkButton *button_unused, gpointer user_data_u
{
for (; li; li = li->next)
{
- if (GTK_IS_TOGGLE_BUTTON(li->data))
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(li->data)) == TRUE)
{
- if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(li->data)) == TRUE)
- {
- const char *event_name = gtk_widget_get_tooltip_text(GTK_WIDGET(li->data));
- strbuf_append_strf(reporters_string,
- "%s%s",
- (reporters_string->len != 0 ? ", " : ""),
- event_name
- );
- }
+ const char *event_name = gtk_widget_get_tooltip_text(GTK_WIDGET(li->data));
+ strbuf_append_strf(reporters_string,
+ "%s%s",
+ (reporters_string->len != 0 ? ", " : ""),
+ event_name
+ );
}
}
}
@@ -434,20 +431,19 @@ static GtkWidget *add_event_buttons(GtkBox *box, char *event_name, GCallback fun
event_screen_name = cfg->screen_name;
event_description = cfg->description;
}
+ char *event_label = xasprintf("%s%s%s",
+ event_screen_name,
+ (event_description ? " - " : ""),
+ event_description ? event_description : ""
+ );
- //char *event_label = xasprintf("%s%s%s",
- // event_screen_name,
- // (event_description ? " - " : ""),
- // event_description ? event_description : ""
- //);
//VERB2 log("adding button '%s' to box %p", event_name, box);
GtkWidget *button = radio
- ? gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(first_button), event_screen_name)
- : gtk_check_button_new_with_label(event_screen_name);
- //free(event_label);
-
+ ? gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(first_button), event_label)
+ : gtk_check_button_new_with_label(event_label);
if (!first_button)
first_button = button;
+ free(event_label);
/* Important: tooltip isn't used merely as decoration. We retrieve event name in the toggle handlers! */
gtk_widget_set_tooltip_text(button, event_name);
@@ -462,14 +458,6 @@ static GtkWidget *add_event_buttons(GtkBox *box, char *event_name, GCallback fun
event_name = event_name_end + 1;
gtk_box_pack_start(box, button, /*expand*/ false, /*fill*/ false, /*padding*/ 0);
- if (event_description)
- {
- GtkWidget *label = gtk_label_new(event_description);
- gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
- gtk_misc_set_alignment(GTK_MISC(label), /*xalign:*/ 0.0, /*yalign:*/ 0.0);
- make_label_autowrap_on_resize(GTK_LABEL(label));
- gtk_box_pack_start(box, label, /*expand*/ false, /*fill*/ false, /*padding*/ 0);
- }
if (func)
g_signal_connect(G_OBJECT(button), "toggled", func, NULL);
@@ -566,11 +554,8 @@ void update_gui_state_from_crash_data(void)
GList *li;
for (li = old_reporters; li; li = li->next)
{
- if (GTK_IS_TOGGLE_BUTTON(li->data))
- {
- if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(li->data)) == TRUE)
- li->data = xstrdup(gtk_button_get_label(GTK_BUTTON(li->data)));
- }
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(li->data)) == TRUE)
+ li->data = xstrdup(gtk_button_get_label(GTK_BUTTON(li->data)));
else
li->data = NULL;
}
@@ -582,18 +567,15 @@ void update_gui_state_from_crash_data(void)
GList *li_new;
for (li_new = new_reporters; li_new; li_new = li_new->next)
{
- if (GTK_IS_TOGGLE_BUTTON(li_new->data))
- {
- const char *new_name = gtk_button_get_label(GTK_BUTTON(li_new->data));
- GList *li_old;
+ const char *new_name = gtk_button_get_label(GTK_BUTTON(li_new->data));
+ GList *li_old;
- for (li_old = old_reporters; li_old; li_old = li_old->next)
+ for (li_old = old_reporters; li_old; li_old = li_old->next)
+ {
+ if (strcmp(new_name, li_old->data) == 0)
{
- if (strcmp(new_name, li_old->data) == 0)
- {
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(li_new->data), true);
- break;
- }
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(li_new->data), true);
+ break;
}
}
}
@@ -1041,12 +1023,9 @@ static void next_page(GtkAssistant *assistant, gpointer user_data)
GList *li;
for (li = reporters; li; li = li->next)
{
- if (GTK_IS_TOGGLE_BUTTON(li->data))
- {
- if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(li->data)) == TRUE)
- /* Button's tooltip contains event_name */
- li->data = (gpointer)gtk_widget_get_tooltip_text(GTK_WIDGET(li->data));
- }
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(li->data)) == TRUE)
+ /* Button's tooltip contains event_name */
+ li->data = (gpointer)gtk_widget_get_tooltip_text(GTK_WIDGET(li->data));
else
li->data = NULL;
}