summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2012-01-03 08:58:04 +0000
committerJon A. Cruz <jon@joncruz.org>2012-01-03 08:58:04 +0000
commit7a6239683da762264133d85d7c79aa06fcc7d725 (patch)
tree71deb81dfdf5699c171ee2d00f819ddd4700b1f5
parentMore deprecated GtkTooltips (diff)
downloadinkscape-7a6239683da762264133d85d7c79aa06fcc7d725.tar.gz
inkscape-7a6239683da762264133d85d7c79aa06fcc7d725.zip
Fixed null-pointer ctor crashes.
(bzr r10828)
-rw-r--r--src/extension/extension.cpp34
-rw-r--r--src/extension/param/notebook.cpp7
-rw-r--r--src/live_effects/effect.cpp5
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp24
-rw-r--r--src/ui/widget/rendering-options.cpp8
-rw-r--r--src/ui/widget/selected-style.cpp18
-rw-r--r--src/ui/widget/style-swatch.cpp15
7 files changed, 75 insertions, 36 deletions
diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp
index 0008d22bf..b2cea838c 100644
--- a/src/extension/extension.cpp
+++ b/src/extension/extension.cpp
@@ -640,21 +640,27 @@ class AutoGUI : public Gtk::VBox {
public:
/** \brief Create an AutoGUI object */
AutoGUI (void) : Gtk::VBox() {};
- /** \brief Adds a widget with a tool tip into the autogui
- \param widg Widget to add
- \param tooltip Tooltip for the widget
-
- If there is no widget, nothing happens. Otherwise it is just
- added into the VBox. If there is a tooltip (non-NULL) then it
- is placed on the widget.
- */
- void addWidget (Gtk::Widget * widg, gchar const * tooltip) {
- if (widg == NULL) return;
- this->pack_start(*widg, false, false, 2);
- if (tooltip != NULL) {
- widg->set_tooltip_text(Glib::ustring(_(tooltip)));
+
+ /**
+ * Adds a widget with a tool tip into the autogui.
+ *
+ * If there is no widget, nothing happens. Otherwise it is just
+ * added into the VBox. If there is a tooltip (non-NULL) then it
+ * is placed on the widget.
+ *
+ * @param widg Widget to add.
+ * @param tooltip Tooltip for the widget.
+ */
+ void addWidget(Gtk::Widget *widg, gchar const *tooltip) {
+ if (widg) {
+ this->pack_start(*widg, false, false, 2);
+ if (tooltip) {
+ widg->set_tooltip_text(_(tooltip));
+ } else {
+ widg->set_tooltip_text("");
+ widg->set_has_tooltip(false);
+ }
}
- return;
};
};
diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp
index d65ec3927..99eec7e4b 100644
--- a/src/extension/param/notebook.cpp
+++ b/src/extension/param/notebook.cpp
@@ -209,8 +209,11 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod
gchar const * tip = param->get_tooltip();
// printf("Tip: '%s'\n", tip);
vbox->pack_start(*widg, false, false, 2);
- if (tip != NULL) {
- widg->set_tooltip_text(Glib::ustring(tip));
+ if (tip) {
+ widg->set_tooltip_text(tip);
+ } else {
+ widg->set_tooltip_text("");
+ widg->set_has_tooltip(false);
}
}
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp
index fbd3c90bd..3ce2aeef3 100644
--- a/src/live_effects/effect.cpp
+++ b/src/live_effects/effect.cpp
@@ -566,8 +566,11 @@ Effect::newWidget()
Glib::ustring * tip = param->param_getTooltip();
if (widg) {
vbox->pack_start(*widg, true, true, 2);
- if (tip != NULL) {
+ if (tip) {
widg->set_tooltip_text(*tip);
+ } else {
+ widg->set_tooltip_text("");
+ widg->set_has_tooltip(false);
}
}
}
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index 8a0808bd8..321cc0789 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -103,7 +103,9 @@ public:
_true_val(tv), _false_val(fv)
{
signal_toggled().connect(signal_attr_changed().make_slot());
- if (tip_text) set_tooltip_text(tip_text);
+ if (tip_text) {
+ set_tooltip_text(tip_text);
+ }
}
Glib::ustring get_as_attribute() const
@@ -135,7 +137,9 @@ public:
: Inkscape::UI::Widget::SpinButton(climb_rate, digits),
AttrWidget(a, def)
{
- if (tip_text) set_tooltip_text(tip_text);
+ if (tip_text) {
+ set_tooltip_text(tip_text);
+ }
set_range(lower, upper);
set_increments(step_inc, 0);
@@ -227,8 +231,12 @@ public:
: AttrWidget(a, def), //TO-DO: receive default num-opt-num as parameter in the constructor
_s1(climb_rate, digits), _s2(climb_rate, digits)
{
- if (tt1) _s1.set_tooltip_text(tt1);
- if (tt2) _s2.set_tooltip_text(tt2);
+ if (tt1) {
+ _s1.set_tooltip_text(tt1);
+ }
+ if (tt2) {
+ _s2.set_tooltip_text(tt2);
+ }
_s1.set_range(lower, upper);
_s2.set_range(lower, upper);
_s1.set_increments(step_inc, 0);
@@ -288,7 +296,9 @@ public:
: AttrWidget(a, def)
{
signal_color_set().connect(signal_attr_changed().make_slot());
- if (tip_text) set_tooltip_text(tip_text);
+ if (tip_text) {
+ set_tooltip_text(tip_text);
+ }
Gdk::Color col;
col.set_rgb(65535, 65535, 65535);
@@ -336,7 +346,9 @@ public:
_tree.show();
add(_tree);
set_shadow_type(Gtk::SHADOW_IN);
- if (tip_text) _tree.set_tooltip_text(tip_text);
+ if (tip_text) {
+ _tree.set_tooltip_text(tip_text);
+ }
}
std::vector<double> get_values() const
diff --git a/src/ui/widget/rendering-options.cpp b/src/ui/widget/rendering-options.cpp
index a8c321d7d..7655f25e3 100644
--- a/src/ui/widget/rendering-options.cpp
+++ b/src/ui/widget/rendering-options.cpp
@@ -40,16 +40,16 @@ RenderingOptions::RenderingOptions () :
false)
{
// set up tooltips
- _radio_vector.set_tooltip_text (Glib::ustring(
+ _radio_vector.set_tooltip_text(
_("Render using Cairo vector operations. "
"The resulting image is usually smaller in file "
"size and can be arbitrarily scaled, but some "
- "filter effects will not be correctly rendered.")));
- _radio_bitmap.set_tooltip_text (Glib::ustring(
+ "filter effects will not be correctly rendered."));
+ _radio_bitmap.set_tooltip_text(
_("Render everything as bitmap. The resulting image "
"is usually larger in file size and cannot be "
"arbitrarily scaled without quality loss, but all "
- "objects will be rendered exactly as displayed.")));
+ "objects will be rendered exactly as displayed."));
set_border_width(2);
diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp
index 35d92db7b..afbb52e05 100644
--- a/src/ui/widget/selected-style.cpp
+++ b/src/ui/widget/selected-style.cpp
@@ -70,6 +70,16 @@ ss_subselection_changed( gpointer /*dragger*/, gpointer data )
ss_selection_changed (NULL, data);
}
+namespace {
+
+void clearTooltip( Gtk::Widget &widget )
+{
+ widget.set_tooltip_text("");
+ widget.set_has_tooltip(false);
+}
+
+} // namespace
+
namespace Inkscape {
namespace UI {
namespace Widget {
@@ -904,8 +914,8 @@ SelectedStyle::update()
place->remove();
flag_place->remove();
- place->set_tooltip_text(0);
- flag_place->set_tooltip_text(0);
+ clearTooltip(*place);
+ clearTooltip(*flag_place);
_mode[i] = SS_NA;
_paintserver_id[i].clear();
@@ -1012,8 +1022,8 @@ SelectedStyle::update()
}
// Now query opacity
- _opacity_place.set_tooltip_text(0);
- _opacity_sb.set_tooltip_text(0);
+ clearTooltip(_opacity_place);
+ clearTooltip(_opacity_sb);
int result = sp_desktop_query_style (_desktop, query, QUERY_STYLE_PROPERTY_MASTEROPACITY);
diff --git a/src/ui/widget/style-swatch.cpp b/src/ui/widget/style-swatch.cpp
index 1fdeb39df..759e2ff04 100644
--- a/src/ui/widget/style-swatch.cpp
+++ b/src/ui/widget/style-swatch.cpp
@@ -160,7 +160,10 @@ StyleSwatch::StyleSwatch(SPCSSAttr *css, gchar const *main_tip)
_swatch.signal_button_press_event().connect(sigc::mem_fun(*this, &StyleSwatch::on_click));
- _swatch.set_tooltip_text(main_tip);
+ if (main_tip)
+ {
+ _swatch.set_tooltip_text(main_tip);
+ }
}
void StyleSwatch::setClickVerb(sp_verb_t verb_t) {
@@ -327,8 +330,9 @@ StyleSwatch::setStyle(SPStyle *query)
g_free (str);
}
} else {
- _stroke_width_place.set_tooltip_text(0);
- _stroke_width.set_markup ("");
+ _stroke_width_place.set_tooltip_text("");
+ _stroke_width.set_markup("");
+ _stroke_width.set_has_tooltip(false);
}
gdouble op = SP_SCALE24_TO_FLOAT(query->opacity.value);
@@ -348,8 +352,9 @@ StyleSwatch::setStyle(SPStyle *query)
g_free (str);
}
} else {
- _opacity_place.set_tooltip_text(0);
- _opacity_value.set_markup ("");
+ _opacity_place.set_tooltip_text("");
+ _opacity_value.set_markup("");
+ _opacity_value.set_has_tooltip(false);
}
show_all();