File lockdown.patch of Package empathy

Index: libempathy-gtk/empathy-presence-chooser.c
===================================================================
--- libempathy-gtk/empathy-presence-chooser.c	(revision 1492)
+++ libempathy-gtk/empathy-presence-chooser.c	(working copy)
@@ -38,6 +38,7 @@
 #include <libempathy/empathy-utils.h>
 #include <libempathy/empathy-status-presets.h>
 
+#include "empathy-conf.h"
 #include "empathy-ui-utils.h"
 #include "empathy-images.h"
 #include "empathy-presence-chooser.h"
@@ -676,24 +677,32 @@
 
 	}
 
-	/* Separator. */
-	item = gtk_menu_item_new ();
-	gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-	gtk_widget_show (item);
+	gboolean disable_custom_msgs;
+	empathy_conf_get_bool (empathy_conf_get (),
+			       EMPATHY_PREFS_LOCKDOWN_CUSTOM_MSGS,
+			       &disable_custom_msgs);
 
 	/* Custom messages */
-	item = gtk_image_menu_item_new_with_label (_("Custom messages..."));
-	image = gtk_image_new_from_stock (GTK_STOCK_EDIT, GTK_ICON_SIZE_MENU);
-	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
-	gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-	gtk_widget_show (image);
-	gtk_widget_show (item);
+	if (!disable_custom_msgs)
+	{
+		/* Separator. */
+		item = gtk_menu_item_new ();
+		gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+		gtk_widget_show (item);
 
-	g_signal_connect (item,
-			  "activate",
-			  G_CALLBACK (presence_chooser_custom_activate_cb),
-			  NULL);
+		item = gtk_image_menu_item_new_with_label (_("Custom messages..."));
+		image = gtk_image_new_from_stock (GTK_STOCK_EDIT, GTK_ICON_SIZE_MENU);
+		gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
+		gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+		gtk_widget_show (image);
+		gtk_widget_show (item);
 
+		g_signal_connect (item,
+				  "activate",
+				  G_CALLBACK (presence_chooser_custom_activate_cb),
+				  NULL);
+	}
+
 	return menu;
 }
 
Index: libempathy-gtk/empathy-contact-dialogs.c
===================================================================
--- libempathy-gtk/empathy-contact-dialogs.c	(revision 1492)
+++ libempathy-gtk/empathy-contact-dialogs.c	(working copy)
@@ -34,6 +34,7 @@
 #include <libempathy/empathy-contact-list.h>
 #include <libempathy/empathy-utils.h>
 
+#include "empathy-conf.h"
 #include "empathy-contact-dialogs.h"
 #include "empathy-contact-widget.h"
 #include "empathy-ui-utils.h"
@@ -300,6 +301,14 @@
 		return;
 	}
 
+	gboolean disable_new_contacts;
+	empathy_conf_get_bool (empathy_conf_get (),
+			       EMPATHY_PREFS_LOCKDOWN_NEW_CONTACTS,
+			       &disable_new_contacts);
+
+	if (disable_new_contacts)
+		return;
+
 	/* Create dialog */
 	dialog = gtk_dialog_new ();
 	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
Index: libempathy-gtk/empathy-conf.h
===================================================================
--- libempathy-gtk/empathy-conf.h	(revision 1492)
+++ libempathy-gtk/empathy-conf.h	(working copy)
@@ -55,6 +55,7 @@
 #define EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED   EMPATHY_PREFS_PATH "/conversation/spell_checker_enabled"
 #define EMPATHY_PREFS_CHAT_NICK_COMPLETION_CHAR    EMPATHY_PREFS_PATH "/conversation/nick_completion_char"
 #define EMPATHY_PREFS_CHAT_AVATAR_IN_ICON          EMPATHY_PREFS_PATH "/conversation/avatar_in_icon"
+#define EMPATHY_PREFS_CHAT_DISABLE_LOGGING	   EMPATHY_PREFS_PATH "/conversation/disable_logging"
 #define EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS     EMPATHY_PREFS_PATH "/ui/separate_chat_windows"
 #define EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN        EMPATHY_PREFS_PATH "/ui/main_window_hidden"
 #define EMPATHY_PREFS_UI_AVATAR_DIRECTORY          EMPATHY_PREFS_PATH "/ui/avatar_directory"
@@ -66,6 +67,8 @@
 #define EMPATHY_PREFS_SALUT_ACCOUNT_CREATED        EMPATHY_PREFS_PATH "/accounts/salut_created"
 #define EMPATHY_PREFS_USE_NM                       EMPATHY_PREFS_PATH "/use_nm"
 #define EMPATHY_PREFS_AUTOCONNECT                  EMPATHY_PREFS_PATH "/autoconnect"
+#define EMPATHY_PREFS_LOCKDOWN_CUSTOM_MSGS         EMPATHY_PREFS_PATH "/lockdown/disable_custom_away_messages"
+#define EMPATHY_PREFS_LOCKDOWN_NEW_CONTACTS        EMPATHY_PREFS_PATH "/lockdown/disable_new_contacts"
 
 typedef void (*EmpathyConfNotifyFunc) (EmpathyConf  *conf, 
 				      const gchar *key,
Index: libempathy-gtk/empathy-chat.c
===================================================================
--- libempathy-gtk/empathy-chat.c	(revision 1492)
+++ libempathy-gtk/empathy-chat.c	(working copy)
@@ -80,6 +80,7 @@
 	gpointer           token;
 	gint               contacts_width;
 	gboolean           has_input_vscroll;
+	gboolean           enable_logging;
 
 	GtkWidget         *widget;
 	GtkWidget         *hpaned;
@@ -464,7 +465,7 @@
 		empathy_contact_get_name (sender),
 		empathy_contact_get_handle (sender));
 
-	if (priv->id) {
+	if (priv->id && priv->enable_logging) {
 		gboolean is_chatroom;
 
 		is_chatroom = priv->handle_type == TP_HANDLE_TYPE_ROOM;
@@ -1527,6 +1528,12 @@
 	priv->sent_messages_index = -1;
 	priv->mc = empathy_mission_control_new ();
 
+	gboolean disable_logging;
+	empathy_conf_get_bool (empathy_conf_get (),
+			       EMPATHY_PREFS_CHAT_DISABLE_LOGGING,
+			       &disable_logging);
+	priv->enable_logging = !disable_logging;
+
 	priv->token = empathy_connect_to_account_status_changed (priv->mc,
 						   G_CALLBACK (chat_status_changed_cb),
 						   chat, NULL);
Index: src/empathy-main-window.c
===================================================================
--- src/empathy-main-window.c	(revision 1492)
+++ src/empathy-main-window.c	(working copy)
@@ -430,6 +430,31 @@
 			      "help_contents", "activate", main_window_help_contents_cb,
 			      NULL);
 
+	/* If adding new contacts is locked down, don't show that menu item */
+	gboolean disable_new_contacts;
+	empathy_conf_get_bool (empathy_conf_get (),
+			       EMPATHY_PREFS_LOCKDOWN_NEW_CONTACTS,
+			       &disable_new_contacts);
+	if (disable_new_contacts)
+	{
+		GtkWidget * hide_w = glade_xml_get_widget (glade, "chat_add_contact");
+		gtk_widget_hide (hide_w);
+		hide_w = glade_xml_get_widget (glade, "separator_before_add_contact");
+		gtk_widget_hide (hide_w);
+	}
+
+	/* If logging is disabled, don't show that menu item */
+	gboolean disable_history;
+	empathy_conf_get_bool (empathy_conf_get (),
+			       EMPATHY_PREFS_CHAT_DISABLE_LOGGING,
+			       &disable_history);
+	if (disable_history)
+	{
+		GtkWidget * hide_w = glade_xml_get_widget (glade, "chat_history");
+		gtk_widget_set_sensitive (hide_w, FALSE);
+		gtk_widget_hide (hide_w);
+	}
+
 	/* Set up connection related widgets. */
 	main_window_connection_items_setup (window, glade);
 	g_object_unref (glade);
Index: src/empathy-main-window.glade
===================================================================
--- src/empathy-main-window.glade	(revision 1492)
+++ src/empathy-main-window.glade	(working copy)
@@ -51,7 +51,7 @@
                       </widget>
                     </child>
                     <child>
-                      <widget class="GtkSeparatorMenuItem" id="separator5">
+                      <widget class="GtkSeparatorMenuItem" id="separator_before_add_contact">
                         <property name="visible">True</property>
                       </widget>
                     </child>
openSUSE Build Service is sponsored by