[gnome-packagekit] trivial: Remove some unused code
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-packagekit] trivial: Remove some unused code
- Date: Thu, 4 Sep 2014 15:18:36 +0000 (UTC)
commit 4b127967ad20c64e409028a317753822b05dc4fb
Author: Richard Hughes <richard hughsie com>
Date: Thu Sep 4 16:14:54 2014 +0100
trivial: Remove some unused code
src/egg-string.c | 138 ---------------------------------------------------
src/egg-string.h | 10 ----
src/gpk-debug.c | 18 -------
src/gpk-debug.h | 1 -
src/gpk-dialog.c | 44 ----------------
src/gpk-dialog.h | 3 -
src/gpk-session.c | 143 -----------------------------------------------------
src/gpk-session.h | 8 ---
8 files changed, 0 insertions(+), 365 deletions(-)
---
diff --git a/src/egg-string.c b/src/egg-string.c
index 2f7db0b..3fdbe31 100644
--- a/src/egg-string.c
+++ b/src/egg-string.c
@@ -45,76 +45,6 @@
#include "egg-string.h"
/**
- * egg_strtoint:
- * @text: The text the convert
- * @value: The return numeric return value
- *
- * Converts a string into a signed integer value in a safe way.
- *
- * Return value: %TRUE if the string was converted correctly
- **/
-gboolean
-egg_strtoint (const gchar *text, gint *value)
-{
- gchar *endptr = NULL;
- gint64 value_raw;
-
- /* invalid */
- if (text == NULL)
- return FALSE;
-
- /* parse */
- value_raw = g_ascii_strtoll (text, &endptr, 10);
-
- /* parsing error */
- if (endptr == text)
- return FALSE;
-
- /* out of range */
- if (value_raw > G_MAXINT || value_raw < G_MININT)
- return FALSE;
-
- /* cast back down to value */
- *value = (gint) value_raw;
- return TRUE;
-}
-
-/**
- * egg_strtouint:
- * @text: The text the convert
- * @value: The return numeric return value
- *
- * Converts a string into a unsigned integer value in a safe way.
- *
- * Return value: %TRUE if the string was converted correctly
- **/
-gboolean
-egg_strtouint (const gchar *text, guint *value)
-{
- gchar *endptr = NULL;
- guint64 value_raw;
-
- /* invalid */
- if (text == NULL)
- return FALSE;
-
- /* parse */
- value_raw = g_ascii_strtoull (text, &endptr, 10);
-
- /* parsing error */
- if (endptr == text)
- return FALSE;
-
- /* out of range */
- if (value_raw > G_MAXINT)
- return FALSE;
-
- /* cast back down to value */
- *value = (guint) value_raw;
- return TRUE;
-}
-
-/**
* egg_strzero:
* @text: The text to check
*
@@ -161,71 +91,3 @@ egg_strlen (const gchar *text, guint len)
}
return i;
}
-
-/**
- * egg_strvequal:
- * @id1: the first item of text to test
- * @id2: the second item of text to test
- *
- * This function will check to see if the GStrv arrays are string equal
- *
- * Return value: %TRUE if the arrays are the same, or are both %NULL
- **/
-gboolean
-egg_strvequal (gchar **id1, gchar **id2)
-{
- guint i;
- guint length1;
- guint length2;
-
- if (id1 == NULL && id2 == NULL)
- return TRUE;
-
- if (id1 == NULL || id2 == NULL) {
- g_debug ("GStrv compare invalid '%p' and '%p'", id1, id2);
- return FALSE;
- }
-
- /* check different sizes */
- length1 = g_strv_length (id1);
- length2 = g_strv_length (id2);
- if (length1 != length2)
- return FALSE;
-
- /* text equal each one */
- for (i=0; i<length1; i++) {
- if (g_strcmp0 (id1[i], id2[i]) != 0)
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**
- * egg_strreplace:
- * @text: The input text to make safe
- * @find: What to search for
- * @replace: What to replace with
- *
- * Replaces chars in the text with a replacement.
- * The %find and %replace variables to not have to be of the same length
- *
- * Return value: the new string (copied)
- **/
-gchar *
-egg_strreplace (const gchar *text, const gchar *find, const gchar *replace)
-{
- gchar **array;
- gchar *retval;
-
- /* common case, not found */
- if (strstr (text, find) == NULL) {
- return g_strdup (text);
- }
-
- /* split apart and rejoin with new delimiter */
- array = g_strsplit (text, find, 0);
- retval = g_strjoinv (replace, array);
- g_strfreev (array);
- return retval;
-}
diff --git a/src/egg-string.h b/src/egg-string.h
index 6b8e097..1ef508a 100644
--- a/src/egg-string.h
+++ b/src/egg-string.h
@@ -31,16 +31,6 @@ guint egg_strlen (const gchar *text,
G_GNUC_WARN_UNUSED_RESULT;
gboolean egg_strzero (const gchar *text)
G_GNUC_WARN_UNUSED_RESULT;
-gboolean egg_strvequal (gchar **id1,
- gchar **id2)
- G_GNUC_WARN_UNUSED_RESULT;
-gboolean egg_strtoint (const gchar *text,
- gint *value);
-gboolean egg_strtouint (const gchar *text,
- guint *value);
-gchar *egg_strreplace (const gchar *text,
- const gchar *find,
- const gchar *replace);
G_END_DECLS
diff --git a/src/gpk-debug.c b/src/gpk-debug.c
index 82217d8..96e5410 100644
--- a/src/gpk-debug.c
+++ b/src/gpk-debug.c
@@ -31,24 +31,6 @@ static gboolean _verbose = FALSE;
static gboolean _console = FALSE;
/**
- * gpk_debug_is_verbose:
- *
- * Returns: TRUE if we have debugging enabled
- **/
-gboolean
-gpk_debug_is_verbose (void)
-{
- /* local first */
- if (_verbose)
- return TRUE;
-
- /* fall back to env variable */
- if (g_getenv ("VERBOSE") != NULL)
- return TRUE;
- return FALSE;
-}
-
-/**
* gpk_debug_ignore_cb:
**/
static void
diff --git a/src/gpk-debug.h b/src/gpk-debug.h
index 40d3474..d8f9a66 100644
--- a/src/gpk-debug.h
+++ b/src/gpk-debug.h
@@ -24,7 +24,6 @@
#include <glib.h>
-gboolean gpk_debug_is_verbose (void);
GOptionGroup *gpk_debug_get_option_group (void);
void gpk_debug_add_log_domain (const gchar *log_domain);
diff --git a/src/gpk-dialog.c b/src/gpk-dialog.c
index 516c315..1b800dc 100644
--- a/src/gpk-dialog.c
+++ b/src/gpk-dialog.c
@@ -314,50 +314,6 @@ gpk_dialog_embed_do_not_show_widget (GtkDialog *dialog, const gchar *key)
}
/**
- * gpk_dialog_embed_download_size_widget:
- **/
-gboolean
-gpk_dialog_embed_download_size_widget (GtkDialog *dialog, const gchar *title, guint64 size)
-{
- GtkWidget *label;
- GtkWidget *hbox;
- GtkWidget *widget;
- gchar *text = NULL;
- gchar *size_str = NULL;
-
- /* size is zero, don't show "0 bytes" */
- if (size == 0) {
- label = gtk_label_new (title);
- widget = gtk_dialog_get_content_area (GTK_DIALOG(dialog));
- gtk_container_add_with_properties (GTK_CONTAINER (widget), label,
- "expand", FALSE,
- "fill", FALSE,
- NULL);
- goto out;
- }
-
- /* add a hbox with the size for deps screen */
- size_str = g_format_size (size);
- text = g_strdup_printf ("%s: %s", title, size_str);
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
- widget = gtk_dialog_get_content_area (GTK_DIALOG(dialog));
- gtk_container_add_with_properties (GTK_CONTAINER (widget), hbox,
- "expand", FALSE,
- "fill", FALSE,
- NULL);
-
- /* add a label */
- label = gtk_label_new (text);
- gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
- gtk_widget_show (hbox);
-out:
- gtk_widget_show (label);
- g_free (text);
- g_free (size_str);
- return TRUE;
-}
-
-/**
* gpk_dialog_embed_tabbed_widget
**/
gboolean
diff --git a/src/gpk-dialog.h b/src/gpk-dialog.h
index 3fd252b..b2a0f67 100644
--- a/src/gpk-dialog.h
+++ b/src/gpk-dialog.h
@@ -34,9 +34,6 @@ gboolean gpk_dialog_embed_file_list_widget (GtkDialog *dialog,
GPtrArray *files);
gboolean gpk_dialog_embed_do_not_show_widget (GtkDialog *dialog,
const gchar *key);
-gboolean gpk_dialog_embed_download_size_widget (GtkDialog *dialog,
- const gchar *title,
- guint64 size);
gchar *gpk_dialog_package_id_name_join_locale (gchar **package_ids);
gboolean gpk_dialog_embed_tabbed_widget (GtkDialog *dialog,
GtkNotebook *tabbed_widget);
diff --git a/src/gpk-session.c b/src/gpk-session.c
index caa5078..79958b0 100644
--- a/src/gpk-session.c
+++ b/src/gpk-session.c
@@ -103,26 +103,6 @@ gpk_session_logout (GpkSession *session)
}
/**
- * gpk_session_get_idle:
- **/
-gboolean
-gpk_session_get_idle (GpkSession *session)
-{
- g_return_val_if_fail (GPK_IS_SESSION (session), FALSE);
- return session->priv->is_idle_old;
-}
-
-/**
- * gpk_session_get_inhibited:
- **/
-gboolean
-gpk_session_get_inhibited (GpkSession *session)
-{
- g_return_val_if_fail (GPK_IS_SESSION (session), FALSE);
- return session->priv->is_inhibited_old;
-}
-
-/**
* gpk_session_presence_status_changed_cb:
**/
static void
@@ -206,129 +186,6 @@ out:
}
/**
- * gpk_session_stop_cb:
- **/
-static void
-gpk_session_stop_cb (DBusGProxy *proxy, GpkSession *session)
-{
- g_debug ("emitting ::stop()");
- g_signal_emit (session, signals [STOP], 0);
-}
-
-/**
- * gpk_session_query_end_session_cb:
- **/
-static void
-gpk_session_query_end_session_cb (DBusGProxy *proxy, guint flags, GpkSession *session)
-{
- g_debug ("emitting ::query-end-session(%i)", flags);
- g_signal_emit (session, signals [QUERY_END_SESSION], 0, flags);
-}
-
-/**
- * gpk_session_end_session_cb:
- **/
-static void
-gpk_session_end_session_cb (DBusGProxy *proxy, guint flags, GpkSession *session)
-{
- g_debug ("emitting ::end-session(%i)", flags);
- g_signal_emit (session, signals [END_SESSION], 0, flags);
-}
-
-/**
- * gpk_session_end_session_response:
- **/
-gboolean
-gpk_session_end_session_response (GpkSession *session, gboolean is_okay, const gchar *reason)
-{
- gboolean ret = FALSE;
- GError *error = NULL;
-
- g_return_val_if_fail (GPK_IS_SESSION (session), FALSE);
- g_return_val_if_fail (session->priv->proxy_client_private != NULL, FALSE);
-
- /* no gnome-session */
- if (session->priv->proxy_client_private == NULL) {
- g_warning ("no gnome-session proxy");
- goto out;
- }
-
- /* send response */
- ret = dbus_g_proxy_call (session->priv->proxy_client_private, "EndSessionResponse", &error,
- G_TYPE_BOOLEAN, is_okay,
- G_TYPE_STRING, reason,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
- if (!ret) {
- g_warning ("failed to send session response: %s", error->message);
- g_error_free (error);
- goto out;
- }
-out:
- return ret;
-}
-
-/**
- * gpk_session_register_client:
- **/
-gboolean
-gpk_session_register_client (GpkSession *session, const gchar *app_id, const gchar *client_startup_id)
-{
- gboolean ret = FALSE;
- gchar *client_id = NULL;
- GError *error = NULL;
- DBusGConnection *connection;
-
- g_return_val_if_fail (GPK_IS_SESSION (session), FALSE);
-
- /* no gnome-session */
- if (session->priv->proxy == NULL) {
- g_warning ("no gnome-session");
- goto out;
- }
-
- /* find out if this change altered the inhibited state */
- ret = dbus_g_proxy_call (session->priv->proxy, "RegisterClient", &error,
- G_TYPE_STRING, app_id,
- G_TYPE_STRING, client_startup_id,
- G_TYPE_INVALID,
- DBUS_TYPE_G_OBJECT_PATH, &client_id,
- G_TYPE_INVALID);
- if (!ret) {
- g_warning ("failed to register client '%s': %s", client_startup_id, error->message);
- g_error_free (error);
- goto out;
- }
-
- /* get org.gnome.Session.ClientPrivate interface */
- connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
- session->priv->proxy_client_private = dbus_g_proxy_new_for_name_owner (connection,
GPK_SESSION_MANAGER_SERVICE,
- client_id,
GPK_SESSION_MANAGER_CLIENT_PRIVATE_INTERFACE, &error);
- if (session->priv->proxy_client_private == NULL) {
- g_warning ("DBUS error: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* get Stop */
- dbus_g_proxy_add_signal (session->priv->proxy_client_private, "Stop", G_TYPE_INVALID);
- dbus_g_proxy_connect_signal (session->priv->proxy_client_private, "Stop", G_CALLBACK
(gpk_session_stop_cb), session, NULL);
-
- /* get QueryEndSession */
- dbus_g_proxy_add_signal (session->priv->proxy_client_private, "QueryEndSession", G_TYPE_UINT,
G_TYPE_INVALID);
- dbus_g_proxy_connect_signal (session->priv->proxy_client_private, "QueryEndSession", G_CALLBACK
(gpk_session_query_end_session_cb), session, NULL);
-
- /* get EndSession */
- dbus_g_proxy_add_signal (session->priv->proxy_client_private, "EndSession", G_TYPE_UINT,
G_TYPE_INVALID);
- dbus_g_proxy_connect_signal (session->priv->proxy_client_private, "EndSession", G_CALLBACK
(gpk_session_end_session_cb), session, NULL);
-
- g_debug ("registered startup '%s' to client id '%s'", client_startup_id, client_id);
-out:
- g_free (client_id);
- return ret;
-}
-
-/**
* gpk_session_inhibit_changed_cb:
**/
static void
diff --git a/src/gpk-session.h b/src/gpk-session.h
index c2fc475..e1788a5 100644
--- a/src/gpk-session.h
+++ b/src/gpk-session.h
@@ -63,14 +63,6 @@ GType gpk_session_get_type (void);
GpkSession *gpk_session_new (void);
gboolean gpk_session_logout (GpkSession *session);
-gboolean gpk_session_get_idle (GpkSession *session);
-gboolean gpk_session_get_inhibited (GpkSession *session);
-gboolean gpk_session_register_client (GpkSession *session,
- const gchar *app_id,
- const gchar *client_startup_id);
-gboolean gpk_session_end_session_response (GpkSession *session,
- gboolean is_okay,
- const gchar *reason);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]