After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 658078 - [Patch] main: factor out dbus names acquisition
[Patch] main: factor out dbus names acquisition
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
3.1.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2011-09-02 17:10 UTC by Marc-Antoine Perennou
Modified: 2011-11-08 00:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
main: factor out dbus names acquisition (6.08 KB, patch)
2011-09-02 17:10 UTC, Marc-Antoine Perennou
reviewed Details | Review
main: factor out dbus names acquisition (6.12 KB, patch)
2011-09-02 17:55 UTC, Marc-Antoine Perennou
reviewed Details | Review
main: factor out dbus names acquisition (6.32 KB, patch)
2011-09-03 00:57 UTC, Marc-Antoine Perennou
accepted-commit_now Details | Review
main: factor out dbus names acquisition (6.44 KB, patch)
2011-09-23 18:00 UTC, Marc-Antoine Perennou
accepted-commit_now Details | Review
main: factor out dbus names acquisition (6.49 KB, patch)
2011-10-20 15:28 UTC, Marc-Antoine Perennou
accepted-commit_now Details | Review
main: factor out dbus names acquisition (6.69 KB, patch)
2011-10-20 15:39 UTC, Marc-Antoine Perennou
none Details | Review
main: factor out dbus names acquisition (6.73 KB, patch)
2011-10-20 15:42 UTC, Marc-Antoine Perennou
committed Details | Review
main: Fix shell_dbus_acquire_names() (966 bytes, patch)
2011-11-07 23:24 UTC, Florian Müllner
accepted-commit_now Details | Review
main: Fix shell_dbus_acquire_names() (1.87 KB, patch)
2011-11-07 23:43 UTC, Florian Müllner
none Details | Review
main: Fix shell_dbus_acquire_names() (1.41 KB, patch)
2011-11-07 23:57 UTC, Florian Müllner
committed Details | Review

Description Marc-Antoine Perennou 2011-09-02 17:10:24 UTC
Created attachment 195508 [details] [review]
main: factor out dbus names acquisition

Currently, adding a new dbus name acquisition is involving duplicating code every time.

This patch allows to add a new one by just specifying its name and whether or not a failure is fatal.
Comment 1 Colin Walters 2011-09-02 17:22:29 UTC
Review of attachment 195508 [details] [review]:

::: src/main.c
@@ +63,3 @@
+                          gchar      *name,
+                          gboolean    fatal,
+                          gchar      *other, ...)

Use G_GNUC_NULL_TERMINATED.

@@ +118,3 @@
 
+  request_name_flags |= DBUS_NAME_FLAG_REPLACE_EXISTING;
+  shell_dbus_acquire_names(bus,

Space between identifier and paren.

@@ +132,2 @@
   /* ...and the on-screen keyboard service */
+                           "org.gnome.Caribou.Keyboard", FALSE);

You're missing a NULL terminator here.
Comment 2 Marc-Antoine Perennou 2011-09-02 17:55:14 UTC
Created attachment 195514 [details] [review]
main: factor out dbus names acquisition

Isn't G_GNUC_NULL_TERMINATED only for declarations like in headers ?
Comment 3 Colin Walters 2011-09-02 18:01:13 UTC
Review of attachment 195514 [details] [review]:

Yes, to use G_GNUC_NULL_TERMINATED you'd have to make a separate prototype for the function.  You can put it inside the C file, it doesn't need to be in a .h file.

::: src/main.c
@@ +120,3 @@
+  shell_dbus_acquire_names (bus,
+                            request_name_flags,
+                           &request_name_result,

So...there's no point returning the result here since it will only be the result of the last name acquisition, and we don't use it after.
Comment 4 Marc-Antoine Perennou 2011-09-03 00:57:10 UTC
Created attachment 195549 [details] [review]
main: factor out dbus names acquisition
Comment 5 Colin Walters 2011-09-03 13:20:13 UTC
Review of attachment 195549 [details] [review]:

Looks good, thanks.
Comment 6 Marc-Antoine Perennou 2011-09-23 18:00:42 UTC
Created attachment 197362 [details] [review]
main: factor out dbus names acquisition

Adapt to current master (changes in dbus request flags for caribou)
Comment 7 Jasper St. Pierre (not reading bugmail) 2011-09-30 00:43:14 UTC
Review of attachment 197362 [details] [review]:

::: src/main.c
@@ +114,3 @@
+  shell_dbus_acquire_name (bus,
+                           request_name_flags,
+                          &request_name_result,

Watch your whitespace.

@@ +133,2 @@
   /* ...and the org.freedesktop.Notifications service; we always
    * specify REPLACE_EXISTING to ensure we kill off

This comment, while correct, isn't really appropriate. The mention of REPLACE_EXISTING should go above the acquire_names call.

@@ +140,3 @@
+  shell_dbus_acquire_name (bus,
+                           DBUS_NAME_FLAG_REPLACE_EXISTING,
+                          &request_name_result,

Whitespace.
Comment 8 Marc-Antoine Perennou 2011-10-20 15:28:53 UTC
Created attachment 199538 [details] [review]
main: factor out dbus names acquisition
Comment 9 Jasper St. Pierre (not reading bugmail) 2011-10-20 15:36:14 UTC
Review of attachment 199538 [details] [review]:

Move the REPLACE_EXISTING comment and you should be good to go.
Comment 10 Marc-Antoine Perennou 2011-10-20 15:39:03 UTC
Created attachment 199539 [details] [review]
main: factor out dbus names acquisition
Comment 11 Marc-Antoine Perennou 2011-10-20 15:42:58 UTC
Created attachment 199541 [details] [review]
main: factor out dbus names acquisition
Comment 12 Jasper St. Pierre (not reading bugmail) 2011-10-20 15:50:06 UTC
Review of attachment 199541 [details] [review]:

LGTM.
Comment 13 Jasper St. Pierre (not reading bugmail) 2011-11-05 21:02:02 UTC
Ping?
Comment 14 Jasper St. Pierre (not reading bugmail) 2011-11-06 10:44:13 UTC
Attachment 199541 [details] pushed as 39727d1 - main: factor out dbus names acquisition


Pushed, thanks!
Comment 15 Florian Müllner 2011-11-07 23:23:10 UTC
The patch is wrong, reopening.
Comment 16 Florian Müllner 2011-11-07 23:24:10 UTC
Created attachment 200940 [details] [review]
main: Fix shell_dbus_acquire_names()

Commit 39727d1156 refactored dbus acquisition, but due to wrong use
of va_args we would only ever acquire the first bus name passed.
Comment 17 Jasper St. Pierre (not reading bugmail) 2011-11-07 23:39:21 UTC
Review of attachment 200940 [details] [review]:

Oops. Good catch.
Comment 18 Florian Müllner 2011-11-07 23:43:11 UTC
Created attachment 200942 [details] [review]
main: Fix shell_dbus_acquire_names()

Sorry, that was still wrong - this one should work correctly.
Comment 19 Florian Müllner 2011-11-07 23:57:01 UTC
Created attachment 200943 [details] [review]
main: Fix shell_dbus_acquire_names()

Smaller, less intrusive version.
Comment 20 Jasper St. Pierre (not reading bugmail) 2011-11-07 23:58:05 UTC
Review of attachment 200943 [details] [review]:

Works for me.
Comment 21 Florian Müllner 2011-11-08 00:02:00 UTC
Attachment 200943 [details] pushed as 2b6c5bb - main: Fix shell_dbus_acquire_names()