Skip to content

Commit

Permalink
Merge pull request #37 from anaselli/master
Browse files Browse the repository at this point in the history
BusyCursor fix; Qt consistency: dialog title, seconds in time;
Fixed YTree item selection during items population
  • Loading branch information
mvidner committed Feb 24, 2014
2 parents dd6cc66 + 97f4578 commit a64e2de
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 19 deletions.
10 changes: 10 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
-------------------------------------------------------------------
Wed Feb 19 20:58:13 CET 2014 - anaselli@linux.it

- Added seconds to YTimeField as for Qt
- Fixed BusyCursor
- Fixed YTree item selection during items population,
old implementation ignored selected items.
- Aligned dialog title behavior to QT
- 2.44.1

-------------------------------------------------------------------
Thu Dec 5 16:36:33 UTC 2013 - mvidner@suse.com

Expand Down
2 changes: 1 addition & 1 deletion VERSION.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SET( VERSION_MAJOR "2" )
SET( VERSION_MINOR "44" )
SET( VERSION_PATCH "0" )
SET( VERSION_PATCH "1" )
SET( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SHA1}" )

##### This is need for the libyui core, ONLY.
Expand Down
24 changes: 14 additions & 10 deletions src/YGDialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,17 @@ class YGWindow
parent = GTK_WINDOW (yglast->m_window->getWidget());
}
GtkWindow *window = GTK_WINDOW (m_widget);
// to be back compatible
std::string dialogTitle = "YaSt";

#ifdef LIBYUI_VERSION_NUM
#if LIBYUI_VERSION_AT_LEAST(2,42,3)
dialogTitle = YUI::app()->applicationTitle();
#endif
#endif
if (parent) {
// if there is a parent, this would be a dialog
gtk_window_set_title (window, "");
gtk_window_set_title (window, dialogTitle.c_str());
gtk_window_set_modal (window, TRUE);
gtk_window_set_transient_for (window, parent);
gtk_window_set_type_hint (window, GDK_WINDOW_TYPE_HINT_DIALOG);
Expand All @@ -93,21 +100,15 @@ class YGWindow
atk_object_set_role (peer, ATK_ROLE_DIALOG);
}
else {
gtk_window_set_title (window, dialogTitle.c_str());
#ifdef LIBYUI_VERSION_NUM
#if LIBYUI_VERSION_AT_LEAST(2,42,3)
gtk_window_set_title (window, YUI::app()->applicationTitle().c_str());
GdkPixbuf *pixbuf = YGUtils::loadPixbuf (YUI::app()->applicationIcon());
if (pixbuf) { // default window icon
gtk_window_set_default_icon (pixbuf);
g_object_unref (G_OBJECT (pixbuf));
}
#else
// to be back compatible
gtk_window_set_title (window, "YaST");
#endif
#else
// to be back compatible
gtk_window_set_title (window, "YaST");
#endif
if (YGUI::ui()->unsetBorder())
gtk_window_set_decorated (window, FALSE);
Expand Down Expand Up @@ -181,8 +182,11 @@ class YGWindow
m_busyCursor = gdk_cursor_new_for_display (display, GDK_WATCH);
g_object_ref (G_OBJECT (m_busyCursor));
}
if (!m_isBusy)
gdk_window_set_cursor (gtk_widget_get_window(m_widget), m_busyCursor);
if (!m_isBusy) {
GdkDisplay *display = gtk_widget_get_display (m_widget);
gdk_window_set_cursor (gtk_widget_get_window(m_widget), m_busyCursor);
gdk_display_sync(display);
}
m_isBusy = true;
}

Expand Down
12 changes: 8 additions & 4 deletions src/YGInputField.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ class YGTimeField : public YTimeField, public YGLabeledWidget
YGtkFieldEntry *field = YGTK_FIELD_ENTRY (getWidget());
ygtk_field_entry_add_field (field, ':');
ygtk_field_entry_add_field (field, ':');
ygtk_field_entry_add_field (field, ':');
ygtk_field_entry_setup_field (field, 0, 2, "0123456789");
ygtk_field_entry_setup_field (field, 1, 2, "0123456789");
ygtk_field_entry_setup_field (field, 2, 2, "0123456789");

connect (getWidget(), "field-entry-changed", G_CALLBACK (value_changed_cb), this);
}
Expand All @@ -109,22 +111,24 @@ class YGTimeField : public YTimeField, public YGLabeledWidget
{
BlockEvents block (this);
if (time.empty()) return;
char hours[3], mins[3];
sscanf (time.c_str(), "%2s:%2s", hours, mins);
char hours[3], mins[3], secs[3];
sscanf (time.c_str(), "%2s:%2s:%2s", hours, mins, secs);

YGtkFieldEntry *entry = YGTK_FIELD_ENTRY (getWidget());
ygtk_field_entry_set_field_text (entry, 0, hours);
ygtk_field_entry_set_field_text (entry, 1, mins);
ygtk_field_entry_set_field_text (entry, 2, secs);
}

virtual std::string value()
{
const gchar *hours, *mins;
const gchar *hours, *mins, *secs;
YGtkFieldEntry *entry = YGTK_FIELD_ENTRY (getWidget());
hours = ygtk_field_entry_get_field_text (entry, 0);
mins = ygtk_field_entry_get_field_text (entry, 1);
secs = ygtk_field_entry_get_field_text (entry, 2);

gchar *time = g_strdup_printf ("%02d:%02d:00", atoi (hours), atoi (mins));
gchar *time = g_strdup_printf ("%02d:%02d:%02d", atoi (hours), atoi (mins), atoi (secs));
std::string str (time);
g_free (time);
return str;
Expand Down
6 changes: 2 additions & 4 deletions src/YGTreeView.cc
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,6 @@ class YGTree : public YTree, public YGTreeView
GtkTreeIter iter;
addRow (item, &iter, parent);
setRowText (&iter, 0, item->iconName(), 1, item->label(), this);
#if 0 // yast2-qt ignores `selected flag
if (item->selected()) {
if (hasMultiSelection())
setRowMark (&iter, 2, item->selected());
Expand All @@ -704,20 +703,19 @@ class YGTree : public YTree, public YGTreeView
}
if (((YTreeItem *) item)->isOpen())
expand (&iter);
#endif
for (YItemConstIterator it = item->childrenBegin();
it != item->childrenEnd(); it++)
addNode (*it, &iter);
}

#if 0

void expand (GtkTreeIter *iter)
{
GtkTreePath *path = gtk_tree_model_get_path (getModel(), iter);
gtk_tree_view_expand_row (getView(), path, FALSE);
gtk_tree_path_free (path);
}

#if 0
bool isReallyOpen (YTreeItem *item) // are parents open as well?
{
for (YTreeItem *i = item; i; i = i->parent())
Expand Down

0 comments on commit a64e2de

Please sign in to comment.