[smuxi/stable: 14/15] Frontend-GNOME: fix method not found exception on Win32
- From: Mirco M. M. Bauer <mmmbauer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [smuxi/stable: 14/15] Frontend-GNOME: fix method not found exception on Win32
- Date: Tue, 26 Jan 2021 16:23:47 +0000 (UTC)
commit e0464410b746012325beee706f1340ddcff1a653
Author: Mirco Bauer <meebey meebey net>
Date: Wed Jan 27 00:13:38 2021 +0800
Frontend-GNOME: fix method not found exception on Win32
src/Frontend-GNOME/Frontend-GNOME.csproj | 2 +-
src/Frontend-GNOME/Views/ChatTreeView.cs | 27 ++++++++++++++++-----------
2 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/src/Frontend-GNOME/Frontend-GNOME.csproj b/src/Frontend-GNOME/Frontend-GNOME.csproj
index 70cf8d6f..52c94be8 100644
--- a/src/Frontend-GNOME/Frontend-GNOME.csproj
+++ b/src/Frontend-GNOME/Frontend-GNOME.csproj
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\bin\debug</OutputPath>
-
<DefineConstants>DEBUG;TRACE;LOG4NET;CONFIG_NINI;GTK_SHARP_2_10;NOTIFY_SHARP;IPC_DBUS;DBUS_SHARP;GTKSPELL</DefineConstants>
+ <DefineConstants>DEBUG;TRACE;LOG4NET;CONFIG_NINI;GTK_SHARP_2_10;;GTKSPELL</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
diff --git a/src/Frontend-GNOME/Views/ChatTreeView.cs b/src/Frontend-GNOME/Views/ChatTreeView.cs
index 2e87e371..1a0ac9c4 100644
--- a/src/Frontend-GNOME/Views/ChatTreeView.cs
+++ b/src/Frontend-GNOME/Views/ChatTreeView.cs
@@ -48,12 +48,11 @@ namespace Smuxi.Frontend.Gnome
return;
}
} else {
- iter = FindChatIter(value);
- if (Gtk.TreeIter.Zero.Equals(iter)) {
+ if (!TryFindChatIter(value, out iter)) {
#if LOG4NET
f_Logger.ErrorFormat(
- "set_CurrentChatView(): FindChatIter({0}) " +
- "returned Gtk.TreeIter.Zero, ignoring...", value
+ "set_CurrentChatView(): TryFindChatIter({0}) " +
+ "found no matching chat, ignoring...", value
);
#endif
return;
@@ -171,7 +170,8 @@ namespace Smuxi.Frontend.Gnome
throw new ArgumentNullException("chatView");
}
- var iter = FindChatIter(chatView);
+ Gtk.TreeIter iter;
+ TryFindChatIter(chatView, out iter);
if (!TreeStore.IterIsValid(iter)) {
return;
}
@@ -186,7 +186,8 @@ namespace Smuxi.Frontend.Gnome
throw new ArgumentNullException("chatView");
}
- var iter = FindChatIter(chatView);
+ Gtk.TreeIter iter;
+ TryFindChatIter(chatView, out iter);
//var path = TreeStore.GetPath(iter);
//TreeStore.EmitRowChanged(path, iter);
// HACK: this emits row_changed _and_ sort_iter_changed and there is
@@ -205,7 +206,8 @@ namespace Smuxi.Frontend.Gnome
if (!GetVisibleRange(out visibleStart, out visibleEnd)) {
return false;
}
- var chatIter = FindChatIter(chatView);
+ Gtk.TreeIter chatIter;
+ TryFindChatIter(chatView, out chatIter);
var chatPath = TreeStore.GetPath(chatIter);
// we ignore 0 on purpose, say if a few pixels of a row are returned
// as visible by GetVisibleRange() that is not good enough for us
@@ -463,18 +465,21 @@ namespace Smuxi.Frontend.Gnome
return parentIter;
}
- Gtk.TreeIter FindChatIter(ChatView view)
+ bool TryFindChatIter(ChatView view, out Gtk.TreeIter chatIter)
{
- Gtk.TreeIter chatIter = Gtk.TreeIter.Zero;
+ var found = false;
+ var foundIter = Gtk.TreeIter.Zero;
TreeStore.Foreach((model, path, iter) => {
var candidate = (ChatView) model.GetValue(iter, 0);
if (candidate == view) {
- chatIter = iter;
+ foundIter = iter;
+ found = true;
return true;
}
return false;
});
- return chatIter;
+ chatIter = foundIter;
+ return found;
}
int GetRowNumber(Gtk.TreePath path)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]