Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame^] | 1 | From 869e52a9055c72970fed036a1510f676e6ce0824 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Thu, 13 Jun 2013 01:24:19 -0700 |
| 4 | Subject: [PATCH] Don't call deprecated glib functions and use the new gthread |
| 5 | API. |
| 6 | |
| 7 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 8 | |
| 9 | Upstream-Status: Inappropriate[version Unmaintained Upstream] |
| 10 | --- |
| 11 | client/pk-console.c | 3 ++- |
| 12 | client/pk-generate-pack.c | 3 ++- |
| 13 | client/pk-monitor.c | 3 ++- |
| 14 | contrib/command-not-found/PackageKit.sh | 2 +- |
| 15 | contrib/command-not-found/pk-command-not-found.c | 4 ++-- |
| 16 | contrib/debuginfo-install/pk-debuginfo-install.c | 4 ++-- |
| 17 | src/pk-backend.c | 7 +++++++ |
| 18 | src/pk-main.c | 4 ++-- |
| 19 | 10 files changed, 20 insertions(+), 10 deletions(-) |
| 20 | |
| 21 | diff --git a/client/pk-console.c b/client/pk-console.c |
| 22 | index de927e1..2435f27 100644 |
| 23 | --- a/client/pk-console.c |
| 24 | +++ b/client/pk-console.c |
| 25 | @@ -1264,11 +1264,12 @@ main (int argc, char *argv[]) |
| 26 | bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); |
| 27 | bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); |
| 28 | textdomain (GETTEXT_PACKAGE); |
| 29 | - |
| 30 | +#if !GLIB_CHECK_VERSION(2,32,0) |
| 31 | if (! g_thread_supported ()) |
| 32 | g_thread_init (NULL); |
| 33 | g_type_init (); |
| 34 | dbus_g_thread_init (); |
| 35 | +#endif |
| 36 | |
| 37 | /* do stuff on ctrl-c */ |
| 38 | signal (SIGINT, pk_console_sigint_cb); |
| 39 | diff --git a/client/pk-generate-pack.c b/client/pk-generate-pack.c |
| 40 | index 0b2b40f..20d7e8d 100644 |
| 41 | --- a/client/pk-generate-pack.c |
| 42 | +++ b/client/pk-generate-pack.c |
| 43 | @@ -251,12 +251,13 @@ main (int argc, char *argv[]) |
| 44 | bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); |
| 45 | bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); |
| 46 | textdomain (GETTEXT_PACKAGE); |
| 47 | - |
| 48 | +#if !GLIB_CHECK_VERSION(2,32,0) |
| 49 | if (! g_thread_supported ()) |
| 50 | g_thread_init (NULL); |
| 51 | |
| 52 | g_type_init (); |
| 53 | dbus_g_thread_init (); |
| 54 | +#endif |
| 55 | |
| 56 | /* do stuff on ctrl-c */ |
| 57 | signal (SIGINT, pk_generate_pack_sigint_cb); |
| 58 | diff --git a/client/pk-monitor.c b/client/pk-monitor.c |
| 59 | index f230f7a..d43007f 100644 |
| 60 | --- a/client/pk-monitor.c |
| 61 | +++ b/client/pk-monitor.c |
| 62 | @@ -285,11 +285,12 @@ main (int argc, char *argv[]) |
| 63 | bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); |
| 64 | bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); |
| 65 | textdomain (GETTEXT_PACKAGE); |
| 66 | - |
| 67 | +#if !GLIB_CHECK_VERSION(2,32,0) |
| 68 | if (! g_thread_supported ()) |
| 69 | g_thread_init (NULL); |
| 70 | g_type_init (); |
| 71 | dbus_g_thread_init (); |
| 72 | +#endif |
| 73 | |
| 74 | context = g_option_context_new (NULL); |
| 75 | /* TRANSLATORS: this is a program that monitors PackageKit */ |
| 76 | diff --git a/contrib/command-not-found/PackageKit.sh b/contrib/command-not-found/PackageKit.sh |
| 77 | index d08989c..d708fff 100644 |
| 78 | --- a/contrib/command-not-found/PackageKit.sh |
| 79 | +++ b/contrib/command-not-found/PackageKit.sh |
| 80 | @@ -18,7 +18,7 @@ command_not_found_handle () { |
| 81 | |
| 82 | # run the command, or just print a warning |
| 83 | if [ $runcnf -eq 1 ]; then |
| 84 | - /home/hughsie/.root/libexec/pk-command-not-found $1 |
| 85 | + /usr/lib/packagekit/pk-command-not-found $1 |
| 86 | retval=$? |
| 87 | else |
| 88 | echo "bash: $1: command not found" |
| 89 | diff --git a/contrib/command-not-found/pk-command-not-found.c b/contrib/command-not-found/pk-command-not-found.c |
| 90 | index 70679c0..9f81ce4 100644 |
| 91 | --- a/contrib/command-not-found/pk-command-not-found.c |
| 92 | +++ b/contrib/command-not-found/pk-command-not-found.c |
| 93 | @@ -659,12 +659,12 @@ main (int argc, char *argv[]) |
| 94 | bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); |
| 95 | bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); |
| 96 | textdomain (GETTEXT_PACKAGE); |
| 97 | - |
| 98 | +#if !GLIB_CHECK_VERSION(2,32,0) |
| 99 | if (! g_thread_supported ()) |
| 100 | g_thread_init (NULL); |
| 101 | dbus_g_thread_init (); |
| 102 | g_type_init (); |
| 103 | - |
| 104 | +#endif |
| 105 | context = g_option_context_new (NULL); |
| 106 | /* TRANSLATORS: tool that gets called when the command is not found */ |
| 107 | g_option_context_set_summary (context, _("PackageKit Command Not Found")); |
| 108 | diff --git a/contrib/debuginfo-install/pk-debuginfo-install.c b/contrib/debuginfo-install/pk-debuginfo-install.c |
| 109 | index c12aca5..b0e1e7c 100644 |
| 110 | --- a/contrib/debuginfo-install/pk-debuginfo-install.c |
| 111 | +++ b/contrib/debuginfo-install/pk-debuginfo-install.c |
| 112 | @@ -532,11 +532,11 @@ main (int argc, char *argv[]) |
| 113 | bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); |
| 114 | bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); |
| 115 | textdomain (GETTEXT_PACKAGE); |
| 116 | - |
| 117 | +#if !GLIB_CHECK_VERSION(2,32,0) |
| 118 | if (! g_thread_supported ()) |
| 119 | g_thread_init (NULL); |
| 120 | g_type_init (); |
| 121 | - |
| 122 | +#endif |
| 123 | context = g_option_context_new (NULL); |
| 124 | /* TRANSLATORS: tool that gets called when the command is not found */ |
| 125 | g_option_context_set_summary (context, _("PackageKit Debuginfo Installer")); |
| 126 | diff --git a/src/pk-backend.c b/src/pk-backend.c |
| 127 | index 5216b63..5b83ae4 100644 |
| 128 | --- a/src/pk-backend.c |
| 129 | +++ b/src/pk-backend.c |
| 130 | @@ -2103,7 +2103,14 @@ pk_backend_thread_create (PkBackend *backend, PkBackendThreadFunc func) |
| 131 | egg_warning ("already has thread"); |
| 132 | return FALSE; |
| 133 | } |
| 134 | +#if !GLIB_CHECK_VERSION(2,32,0) |
| 135 | backend->priv->thread = g_thread_create ((GThreadFunc) func, backend, FALSE, NULL); |
| 136 | +#else |
| 137 | + backend->priv->thread = g_thread_try_new ("daemon thread", (GThreadFunc) func, backend, NULL); |
| 138 | + if (backend->priv->thread != NULL) { |
| 139 | + g_thread_unref(backend->priv->thread); |
| 140 | + } |
| 141 | +#endif |
| 142 | if (backend->priv->thread == NULL) { |
| 143 | egg_warning ("failed to create thread"); |
| 144 | return FALSE; |
| 145 | diff --git a/src/pk-main.c b/src/pk-main.c |
| 146 | index 4c758cd..8fa2482 100644 |
| 147 | --- a/src/pk-main.c |
| 148 | +++ b/src/pk-main.c |
| 149 | @@ -219,12 +219,12 @@ main (int argc, char *argv[]) |
| 150 | bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); |
| 151 | bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); |
| 152 | textdomain (GETTEXT_PACKAGE); |
| 153 | - |
| 154 | +#if !GLIB_CHECK_VERSION(2,32,0) |
| 155 | if (! g_thread_supported ()) |
| 156 | g_thread_init (NULL); |
| 157 | dbus_g_thread_init (); |
| 158 | g_type_init (); |
| 159 | - |
| 160 | +#endif |
| 161 | /* TRANSLATORS: describing the service that is running */ |
| 162 | context = g_option_context_new (_("PackageKit service")); |
| 163 | g_option_context_add_main_entries (context, options, NULL); |
| 164 | -- |
| 165 | 1.7.9.5 |
| 166 | |