[chronojump] encoderConfiguration window. Delete Done!
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] encoderConfiguration window. Delete Done!
- Date: Mon, 9 Jan 2017 22:02:58 +0000 (UTC)
commit 115f9f183b057c11a30a0c614ca37fc0339eb7f4
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Jan 9 23:02:28 2017 +0100
encoderConfiguration window. Delete Done!
src/gui/encoderConfiguration.cs | 14 +++++++++++---
src/utilGtk.cs | 10 +++++++---
2 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/src/gui/encoderConfiguration.cs b/src/gui/encoderConfiguration.cs
index 88c135b..64779d9 100644
--- a/src/gui/encoderConfiguration.cs
+++ b/src/gui/encoderConfiguration.cs
@@ -734,15 +734,23 @@ public class EncoderConfigurationWindow
}
}
- //TODO: select another row (and "active" it)
- //TODO: cannot delete if only there's the only on this encoderGI
void on_button_delete_clicked (object o, EventArgs args)
{
string selectedName = getSelectedName();
if(selectedName == "")
return;
- UtilGtk.RemoveRow(treeview_select, store);
+ if(UtilGtk.CountRows(store) <= 1) {
+ new DialogMessage(Constants.MessageTypes.WARNING,
+ Catalog.GetString("Sorry, cannot delete all rows.") + "\n");
+ return;
+ }
+
+ //treeview
+ UtilGtk.RemoveRow(treeview_select, store); //1 delete row
+ UtilGtk.TreeviewSelectFirstRow(treeview_select, store, true); //2 selects another row (use
first)
+
+ //SQL
Sqlite.DeleteFromName(false, Constants.EncoderConfigurationTable, "name", selectedName);
}
diff --git a/src/utilGtk.cs b/src/utilGtk.cs
index 8bb7d86..0b8df9d 100644
--- a/src/utilGtk.cs
+++ b/src/utilGtk.cs
@@ -285,6 +285,10 @@ public class UtilGtk
return -1;
}
+ public static bool TreeviewSelectFirstRow(Gtk.TreeView tv, Gtk.TreeStore store, bool scrollToRow)
+ {
+ return treeviewSelectRow(tv, store, 0, scrollToRow);
+ }
//selects a row that has an uniqueID (usually at col 0)
public static bool TreeviewSelectRowWithID(Gtk.TreeView tv, Gtk.TreeStore store, int colNum, int id,
bool scrollToRow)
{
@@ -292,7 +296,7 @@ public class UtilGtk
return false;
int rowNum = getRowNumOfThisID(store, colNum, id);
- return TreeviewSelectRow(tv, store, rowNum, scrollToRow);
+ return treeviewSelectRow(tv, store, rowNum, scrollToRow);
}
public static bool TreeviewSelectRowWithName(Gtk.TreeView tv, Gtk.TreeStore store, int colNum, string
name, bool scrollToRow)
{
@@ -300,9 +304,9 @@ public class UtilGtk
return false;
int rowNum = getRowNumOfThisName(store, colNum, name);
- return TreeviewSelectRow(tv, store, rowNum, scrollToRow);
+ return treeviewSelectRow(tv, store, rowNum, scrollToRow);
}
- private static bool TreeviewSelectRow(Gtk.TreeView tv, Gtk.TreeStore store, int rowNum, bool
scrollToRow)
+ private static bool treeviewSelectRow(Gtk.TreeView tv, Gtk.TreeStore store, int rowNum, bool
scrollToRow)
{
if(rowNum == -1)
return false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]