Author: rpmcruz
Date: Mon Apr 19 12:30:10 2010
New Revision: 61750
URL: http://svn.opensuse.org/viewcvs/yast?rev=61750&view=rev
Log:
* src/ygtktreeview.h/c: make "no entries." string
customizable.
* src/pkg/ygtkpkgfilterview.cc: always show "all packages"
item.
* src/pkg/ygtkpkgfilterview.cc: depending on the filter
show entries while loading or not.
Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGDialog.cc
trunk/gtk/src/YGTable.cc
trunk/gtk/src/pkg/ygtkpkgdetailview.cc
trunk/gtk/src/pkg/ygtkpkgfilterview.cc
trunk/gtk/src/pkg/ygtkpkgfilterview.h
trunk/gtk/src/pkg/ygtkpkghistorydialog.cc
trunk/gtk/src/pkg/ygtkpkglistview.cc
trunk/gtk/src/pkg/ygtkpkgpatternview.cc
trunk/gtk/src/ygtktreeview.c
trunk/gtk/src/ygtktreeview.h
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=61750&r1=61749&r2=61750&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Mon Apr 19 12:30:10 2010
@@ -1,3 +1,14 @@
+2010-04-19 Ricardo Cruz
+
+ * src/ygtktreeview.h/c: make "no entries." string
+ customizable.
+
+ * src/pkg/ygtkpkgfilterview.cc: always show "all packages"
+ item.
+
+ * src/pkg/ygtkpkgfilterview.cc: depending on the filter
+ show entries while loading or not.
+
2010-04-18 Ricardo Cruz
* src/pkg/ygtkcellrendererbutton.c: bug fix: only select
Modified: trunk/gtk/src/YGDialog.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGDialog.cc?rev=61750&r1=61749&r2=61750&view=diff
==============================================================================
--- trunk/gtk/src/YGDialog.cc (original)
+++ trunk/gtk/src/YGDialog.cc Mon Apr 19 12:30:10 2010
@@ -238,7 +238,7 @@
return TRUE;
case GDK_X:
yuiMilestone() << "Starting xterm\n";
- system ("/usr/bin/xterm &");
+ (void) system ("/usr/bin/xterm &");
return TRUE;
case GDK_H:
dumpYastHtml (pThis->getChild());
Modified: trunk/gtk/src/YGTable.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGTable.cc?rev=61750&r1=61749&r2=61750&view=diff
==============================================================================
--- trunk/gtk/src/YGTable.cc (original)
+++ trunk/gtk/src/YGTable.cc Mon Apr 19 12:30:10 2010
@@ -1,7 +1,9 @@
/********************************************************************
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
+/* Textdomain "yast2-gtk" */
+#include "YGi18n.h"
#define YUILogComponent "gtk"
#include "config.h"
#include "YGUI.h"
@@ -239,6 +241,7 @@
{
gtk_tree_view_set_headers_visible (getView(), TRUE);
gtk_tree_view_set_rules_hint (getView(), columns() > 1);
+ ygtk_tree_view_set_empty_text (YGTK_TREE_VIEW (getView()), _("No entries."));
#if YAST2_VERSION >= 2017005
if (multiSelection)
gtk_tree_selection_set_mode (getSelection(), GTK_SELECTION_MULTIPLE);
Modified: trunk/gtk/src/pkg/ygtkpkgdetailview.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgdetailview.cc?rev=61750&r1=61749&r2=61750&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgdetailview.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgdetailview.cc Mon Apr 19 12:30:10 2010
@@ -212,7 +212,7 @@
command += link;
}
command += " &";
- system (command.c_str());
+ (void) system (command.c_str());
}
static void copy_link_cb (GtkMenuItem *item, DetailDescription *pThis)
@@ -846,7 +846,7 @@
static void dirname_pressed_cb (GtkWidget *text, const gchar *link, FilelistExpander *pThis)
{
gchar *cmd = g_strdup_printf (GNOME_OPEN_BIN " %s &", link);
- system (cmd);
+ (void) system (cmd);
g_free (cmd);
}
Modified: trunk/gtk/src/pkg/ygtkpkgfilterview.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgfilterview.cc?rev=61750&r1=61749&r2=61750&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgfilterview.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgfilterview.cc Mon Apr 19 12:30:10 2010
@@ -106,8 +106,8 @@
return createToolboxRow (row);
}
-void YGtkPkgFilterModel::addRow (const char *icon,
- const char *text, bool enabled, gpointer data)
+void YGtkPkgFilterModel::addRow (const char *icon, const char *text,
+ bool enabled, gpointer data, bool defaultVisible)
{
// we use cell-render-pixbuf's "pixbuf" rather than "icon-name" so we
// can use a fixed size
@@ -116,11 +116,11 @@
pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default(),
icon, 32, GtkIconLookupFlags (0), NULL);
- GtkListStore *store = GTK_LIST_STORE (impl->model);
GtkTreeIter iter;
+ GtkListStore *store = GTK_LIST_STORE (impl->model);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, ICON_COLUMN, pixbuf, TEXT_COLUMN, text,
- COUNT_NUMBER_COLUMN, "", ENABLED_COLUMN, enabled, VISIBLE_COLUMN, TRUE,
+ COUNT_NUMBER_COLUMN, "", ENABLED_COLUMN, enabled, VISIBLE_COLUMN, defaultVisible,
DATA_COLUMN, data, -1);
if (pixbuf) g_object_unref (pixbuf);
@@ -129,7 +129,7 @@
void YGtkPkgFilterModel::addSeparator()
{ addRow (NULL, "", true, NULL); }
-void YGtkPkgFilterModel::setRowCount (int row, int count, bool hide_if_zero)
+void YGtkPkgFilterModel::setRowCount (int row, int count)
{
GtkListStore *store = GTK_LIST_STORE (impl->model);
GtkTreeIter iter;
@@ -137,7 +137,7 @@
gchar *str = g_strdup_printf ("%d", count);
gtk_list_store_set (store, &iter, COUNT_NUMBER_COLUMN, str,
- VISIBLE_COLUMN, !hide_if_zero || count > 0, -1);
+ VISIBLE_COLUMN, row == 0 || count > 0, -1);
g_free (str);
}
@@ -189,15 +189,15 @@
if (YGPackageSelector::get()->onlineUpdateMode()) {
addRow (NULL, _("Available"), true, 0);
addRow (NULL, _("Installed"), true, 0);
- addRow (NULL, _("Modified"), true, 0);
+ addRow (NULL, _("Modified"), true, 0, false);
}
else {
addRow (NULL, _("Any status"), true, 0);
addRow (NULL, _("Not installed"), true, 0);
addRow (NULL, _("Installed"), true, 0);
- addRow (NULL, _("Upgradable"), true, 0);
- addRow (NULL, _("Locked"), true, 0);
- addRow (NULL, _("Modified"), true, 0);
+ addRow (NULL, _("Upgradable"), true, 0, false);
+ addRow (NULL, _("Locked"), true, 0, false);
+ addRow (NULL, _("Modified"), true, 0, false);
}
}
@@ -210,9 +210,8 @@
void YGtkPkgStatusModel::updateRow (Ypp::List list, int row, gpointer data)
{
impl->list = list;
- bool hide_if_zero = row > 0;
Ypp::StatusMatch match (rowToStatus (row));
- setRowCount (row, list.count (&match), hide_if_zero);
+ setRowCount (row, list.count (&match));
}
bool YGtkPkgStatusModel::writeRowQuery (Ypp::PoolQuery &query, int row, gpointer data)
@@ -491,7 +490,7 @@
{
addRow (NULL, _("All packages"), true, 0);
for (int i = 0; i < Ypp::Package::supportTotal(); i++)
- addRow (NULL, Ypp::Package::supportSummary (i).c_str(), true, 0);
+ addRow (NULL, Ypp::Package::supportSummary (i).c_str(), true, 0, false);
}
void YGtkPkgSupportModel::updateRow (Ypp::List list, int row, gpointer data)
@@ -512,7 +511,7 @@
{
addRow (NULL, _("Any priority"), true, 0);
for (int i = 0; i < Ypp::Patch::priorityTotal(); i++)
- addRow (NULL, Ypp::Patch::prioritySummary (i), true, 0);
+ addRow (NULL, Ypp::Patch::prioritySummary (i), true, 0, false);
}
void YGtkPkgPriorityModel::updateRow (Ypp::List list, int row, gpointer data)
@@ -564,7 +563,7 @@
: YGtkPkgQueryWidget(), impl (new Impl (model))
{
bool updates = model->begsUpdate();
- impl->view = ygtk_tree_view_new();
+ impl->view = ygtk_tree_view_new (NULL);
gtk_tree_view_set_model (GTK_TREE_VIEW (impl->view), model->getModel());
GtkTreeView *view = GTK_TREE_VIEW (impl->view);
gtk_tree_view_set_headers_visible (view, FALSE);
Modified: trunk/gtk/src/pkg/ygtkpkgfilterview.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgfilterview.h?rev=61750&r1=61749&r2=61750&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgfilterview.h (original)
+++ trunk/gtk/src/pkg/ygtkpkgfilterview.h Mon Apr 19 12:30:10 2010
@@ -42,9 +42,9 @@
virtual GtkWidget *createInternalToolbox() { return NULL; }
virtual GtkWidget *createInternalPopup() { return NULL; }
- void addRow (const char *icon, const char *text, bool enabled, gpointer data);
+ void addRow (const char *icon, const char *text, bool enabled, gpointer data, bool defaultVisible = true);
void addSeparator();
- void setRowCount (int row, int count, bool hide_if_zero = true);
+ void setRowCount (int row, int count);
struct Impl;
Impl *impl;
Modified: trunk/gtk/src/pkg/ygtkpkghistorydialog.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkghistorydialog.cc?rev=61750&r1=61749&r2=61750&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkghistorydialog.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkghistorydialog.cc Mon Apr 19 12:30:10 2010
@@ -211,13 +211,13 @@
{ fclose (file); }
void addSpace()
- { fwrite ("\n", sizeof (char), 1, file); }
+ { (void) fwrite ("\n", sizeof (char), 1, file); }
virtual void date (const std::string &str, bool first)
{
if (!first)
addSpace();
- fwrite (str.c_str(), sizeof (char), str.size(), file);
+ (void) fwrite (str.c_str(), sizeof (char), str.size(), file);
addSpace(); addSpace();
}
@@ -228,7 +228,7 @@
std::string str;
str.reserve (action.size() + name.size() + description.size() + 4);
str = std::string ("\t") + action + " " + name + " " + description + "\n";
- fwrite (str.c_str(), sizeof (char), str.size(), file);
+ (void) fwrite (str.c_str(), sizeof (char), str.size(), file);
}
};
@@ -485,7 +485,7 @@
GtkCellRenderer *renderer, *pix_renderer;
GtkTreeViewColumn *column;
- GtkWidget *log_view = ygtk_tree_view_new();
+ GtkWidget *log_view = ygtk_tree_view_new (NULL);
gtk_tree_view_set_search_column (GTK_TREE_VIEW (log_view), LogListHandler::SHORTCUT_COLUMN);
gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (log_view), TRUE);
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (log_view), TRUE);
Modified: trunk/gtk/src/pkg/ygtkpkglistview.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkglistview.cc?rev=61750&r1=61749&r2=61750&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkglistview.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkglistview.cc Mon Apr 19 12:30:10 2010
@@ -620,7 +620,7 @@
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (impl->scroll),
GTK_SHADOW_IN);
- GtkTreeView *view = GTK_TREE_VIEW (impl->view = ygtk_tree_view_new());
+ GtkTreeView *view = GTK_TREE_VIEW (impl->view = ygtk_tree_view_new (_("No matches.")));
if (!variableHeight)
gtk_tree_view_set_fixed_height_mode (view, TRUE);
gtk_tree_view_set_headers_visible (view, FALSE);
Modified: trunk/gtk/src/pkg/ygtkpkgpatternview.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgpatternview.cc?rev=61750&r1=61749&r2=61750&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgpatternview.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgpatternview.cc Mon Apr 19 12:30:10 2010
@@ -372,7 +372,7 @@
g_object_set_data (G_OBJECT (store), "patterns", GINT_TO_POINTER (1));
}
- impl->view = ygtk_tree_view_new();
+ impl->view = ygtk_tree_view_new (NULL);
gtk_tree_view_set_model (GTK_TREE_VIEW (impl->view), GTK_TREE_MODEL (store));
g_object_unref (G_OBJECT (store));
GtkTreeView *view = GTK_TREE_VIEW (impl->view);
Modified: trunk/gtk/src/ygtktreeview.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtktreeview.c?rev=61750&r1=61749&r2=61750&view=diff
==============================================================================
--- trunk/gtk/src/ygtktreeview.c (original)
+++ trunk/gtk/src/ygtktreeview.c Mon Apr 19 12:30:10 2010
@@ -19,6 +19,16 @@
{
}
+static void ygtk_tree_view_finalize (GObject *object)
+{
+ YGtkTreeView *view = YGTK_TREE_VIEW (object);
+ if (view->empty_text) {
+ g_free (view->empty_text);
+ view->empty_text = NULL;
+ }
+ G_OBJECT_CLASS (ygtk_tree_view_parent_class)->finalize (object);
+}
+
static void _gtk_widget_destroy (gpointer widget)
{ gtk_widget_destroy (GTK_WIDGET (widget)); }
@@ -76,11 +86,13 @@
{
GTK_WIDGET_CLASS (ygtk_tree_view_parent_class)->expose_event (widget, event);
- if (event->window == gtk_tree_view_get_bin_window (GTK_TREE_VIEW (widget))) {
- GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
+ GtkTreeView *view = GTK_TREE_VIEW (widget);
+ YGtkTreeView *yview = YGTK_TREE_VIEW (widget);
+ if (yview->empty_text && event->window == gtk_tree_view_get_bin_window (view)) {
+ GtkTreeModel *model = gtk_tree_view_get_model (view);
GtkTreeIter iter;
if (!model || !gtk_tree_model_get_iter_first (model, &iter)) { // empty tree-view
- const char *text = _("No entries.");
+ const gchar *text = yview->empty_text;
if (!model)
text = _("Loading...");
cairo_t *cr = gdk_cairo_create (event->window);
@@ -205,8 +217,19 @@
gtk_tree_view_insert_column (GTK_TREE_VIEW (view), column, pos);
}
-GtkWidget *ygtk_tree_view_new (void)
-{ return g_object_new (YGTK_TYPE_TREE_VIEW, NULL); }
+void ygtk_tree_view_set_empty_text (YGtkTreeView *view, const gchar *empty_text)
+{
+ if (view->empty_text)
+ g_free (view->empty_text);
+ view->empty_text = empty_text ? g_strdup (empty_text) : NULL;
+}
+
+GtkWidget *ygtk_tree_view_new (const gchar *empty_text)
+{
+ YGtkTreeView *view = (YGtkTreeView *) g_object_new (YGTK_TYPE_TREE_VIEW, NULL);
+ view->empty_text = empty_text ? g_strdup (empty_text) : NULL;
+ return GTK_WIDGET (view);
+}
static void ygtk_tree_view_class_init (YGtkTreeViewClass *klass)
{
@@ -215,6 +238,9 @@
gtkwidget_class->popup_menu = _ygtk_tree_view_popup_menu;
gtkwidget_class->expose_event = _ygtk_tree_view_expose_event;
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = ygtk_tree_view_finalize;
+
right_click_signal = g_signal_new ("right-click",
G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (YGtkTreeViewClass, right_click),
Modified: trunk/gtk/src/ygtktreeview.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtktreeview.h?rev=61750&r1=61749&r2=61750&view=diff
==============================================================================
--- trunk/gtk/src/ygtktreeview.h (original)
+++ trunk/gtk/src/ygtktreeview.h Mon Apr 19 12:30:10 2010
@@ -26,6 +26,9 @@
typedef struct _YGtkTreeView
{
GtkTreeView parent;
+
+ // members:
+ gchar *empty_text;
} YGtkTreeView;
typedef struct _YGtkTreeViewClass
@@ -36,9 +39,11 @@
void (*right_click) (YGtkTreeView *view, gboolean outreach);
} YGtkTreeViewClass;
-GtkWidget* ygtk_tree_view_new (void);
+GtkWidget* ygtk_tree_view_new (const gchar *empty_text); /* null to disable */
GType ygtk_tree_view_get_type (void) G_GNUC_CONST;
+void ygtk_tree_view_set_empty_text (YGtkTreeView *view, const gchar *empty_text);
+
void ygtk_tree_view_popup_menu (YGtkTreeView *view, GtkWidget *menu);
GtkWidget *ygtk_tree_view_create_show_columns_menu (YGtkTreeView *view);
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org