[libgda] Don't show transactions possibilities for virtual connections
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Don't show transactions possibilities for virtual connections
- Date: Sat, 21 May 2011 09:11:21 +0000 (UTC)
commit 51e756d7b09b62af308d21c46400b6a6fdb5ce13
Author: Vivien Malerba <malerba gnome-db org>
Date: Sat May 21 11:01:08 2011 +0200
Don't show transactions possibilities for virtual connections
tools/browser/browser-connection.c | 19 +++++++++++++++++++
tools/browser/browser-connection.h | 1 +
tools/browser/browser-window.c | 9 +++++++++
tools/browser/doc/gda-browser-sections.txt | 1 +
4 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/tools/browser/browser-connection.c b/tools/browser/browser-connection.c
index bb59d6a..2032049 100644
--- a/tools/browser/browser-connection.c
+++ b/tools/browser/browser-connection.c
@@ -28,6 +28,7 @@
#include <libgda-ui/gdaui-enums.h>
#include "../config-info.h"
#include "browser-virtual-connection.h"
+#include <sqlite/virtual/gda-virtual-connection.h>
#include "browser-connection-priv.h"
@@ -823,6 +824,24 @@ browser_connection_get_information (BrowserConnection *bcnc)
}
/**
+ * browser_connection_is_virtual
+ * @bcnc: a #BrowserConnection
+ *
+ * Tells if @bcnc is a virtual connection or not
+ *
+ * Returns: %TRUE if @bcnc is a virtual connection
+ */
+gboolean
+browser_connection_is_virtual (BrowserConnection *bcnc)
+{
+ g_return_val_if_fail (BROWSER_IS_CONNECTION (bcnc), FALSE);
+ if (GDA_IS_VIRTUAL_CONNECTION (bcnc->priv->cnc))
+ return TRUE;
+ else
+ return FALSE;
+}
+
+/**
* browser_connection_is_busy
* @bcnc: a #BrowserConnection
* @out_reason: a pointer to store a copy of the reason @bcnc is busy (will be set
diff --git a/tools/browser/browser-connection.h b/tools/browser/browser-connection.h
index 9c0784e..606d369 100644
--- a/tools/browser/browser-connection.h
+++ b/tools/browser/browser-connection.h
@@ -76,6 +76,7 @@ const gchar *browser_connection_get_name (BrowserConnection
const GdaDsnInfo *browser_connection_get_information (BrowserConnection *bcnc);
gboolean browser_connection_is_busy (BrowserConnection *bcnc, gchar **out_reason);
+gboolean browser_connection_is_virtual (BrowserConnection *bcnc);
void browser_connection_update_meta_data (BrowserConnection *bcnc);
void browser_connection_meta_data_changed (BrowserConnection *bcnc);
GdaMetaStruct *browser_connection_get_meta_struct (BrowserConnection *bcnc);
diff --git a/tools/browser/browser-window.c b/tools/browser/browser-window.c
index 2f880b3..2314001 100644
--- a/tools/browser/browser-window.c
+++ b/tools/browser/browser-window.c
@@ -421,6 +421,15 @@ browser_window_new (BrowserConnection *bcnc, BrowserPerspectiveFactory *factory)
bwin->priv->agroup = group;
gtk_action_group_add_actions (group, ui_actions, G_N_ELEMENTS (ui_actions), bwin);
gtk_action_group_add_toggle_actions (group, ui_toggle_actions, G_N_ELEMENTS (ui_toggle_actions), bwin);
+ if (browser_connection_is_virtual (bwin->priv->bcnc)) {
+ GtkAction *action;
+ action = gtk_action_group_get_action (bwin->priv->agroup, "TransactionBegin");
+ gtk_action_set_visible (action, FALSE);
+ action = gtk_action_group_get_action (bwin->priv->agroup, "TransactionCommit");
+ gtk_action_set_visible (action, FALSE);
+ action = gtk_action_group_get_action (bwin->priv->agroup, "TransactionRollback");
+ gtk_action_set_visible (action, FALSE);
+ }
transaction_status_changed_cb (bwin->priv->bcnc, bwin);
ui = gtk_ui_manager_new ();
diff --git a/tools/browser/doc/gda-browser-sections.txt b/tools/browser/doc/gda-browser-sections.txt
index 9d0cc88..7ffd91d 100644
--- a/tools/browser/doc/gda-browser-sections.txt
+++ b/tools/browser/doc/gda-browser-sections.txt
@@ -79,6 +79,7 @@ BrowserConnection
browser_connection_new
browser_connection_get_name
browser_connection_get_information
+browser_connection_is_virtual
browser_connection_is_busy
browser_connection_update_meta_data
browser_connection_meta_data_changed
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]