Silence a few valac warnings regarding error-handling of DBus methods

This commit is contained in:
Rico Tzschichholz 2018-09-10 14:45:42 +02:00
parent 4ce4b83bce
commit d38aed64e7
6 changed files with 18 additions and 17 deletions

View File

@ -97,7 +97,7 @@ namespace Gala.Plugins.Notify
app_info_cache = new Gee.HashMap<string, AppInfo> ();
}
public string [] get_capabilities ()
public string [] get_capabilities () throws DBusError, IOError
{
return {
"body",
@ -114,7 +114,7 @@ namespace Gala.Plugins.Notify
}
public void get_server_information (out string name, out string vendor,
out string version, out string spec_version)
out string version, out string spec_version) throws DBusError, IOError
{
name = "pantheon-notify";
vendor = "elementaryOS";
@ -127,7 +127,7 @@ namespace Gala.Plugins.Notify
*
* @param id The id of the notification to be closed.
*/
public void close_notification (uint32 id) throws DBusError
public void close_notification (uint32 id) throws DBusError, IOError
{
foreach (var child in stack.get_children ()) {
unowned Notification notification = (Notification) child;
@ -148,6 +148,7 @@ namespace Gala.Plugins.Notify
public new uint32 notify (string app_name, uint32 replaces_id, string app_icon, string summary,
string body, string[] actions, HashTable<string, Variant> hints, int32 expire_timeout, BusName sender)
throws DBusError, IOError
{
unowned Variant? variant = null;

View File

@ -64,7 +64,7 @@ namespace Gala
assert_not_reached ();
}
public void perform_action (ActionType type)
public void perform_action (ActionType type) throws DBusError, IOError
{
wm.perform_action (type);
}
@ -114,7 +114,7 @@ namespace Gala
*/
public async ColorInformation get_background_color_information (int monitor,
int reference_x, int reference_y, int reference_width, int reference_height)
throws DBusError
throws DBusError, IOError
{
var background = wm.background_group.get_child_at_index (monitor);
if (background == null)

View File

@ -63,7 +63,7 @@ namespace Gala
}
}
public uint grab_accelerator (string accelerator, uint flags)
public uint grab_accelerator (string accelerator, uint flags) throws DBusError, IOError
{
uint? action = grabbed_accelerators[accelerator];
@ -77,7 +77,7 @@ namespace Gala
return action;
}
public uint[] grab_accelerators (Accelerator[] accelerators)
public uint[] grab_accelerators (Accelerator[] accelerators) throws DBusError, IOError
{
uint[] actions = {};
@ -88,7 +88,7 @@ namespace Gala
return actions;
}
public bool ungrab_accelerator (uint action)
public bool ungrab_accelerator (uint action) throws DBusError, IOError
{
bool ret = false;
@ -104,7 +104,7 @@ namespace Gala
}
[DBus (name = "ShowOSD")]
public void show_osd (GLib.HashTable<string, Variant> parameters)
public void show_osd (GLib.HashTable<string, Variant> parameters) throws DBusError, IOError
{
int32 monitor_index = -1;
if (parameters.contains ("monitor"))

View File

@ -21,7 +21,7 @@ namespace Gala
interface DBusNotifications : GLib.Object
{
public abstract uint32 notify (string app_name, uint32 replaces_id, string app_icon, string summary,
string body, string[] actions, HashTable<string, Variant> hints, int32 expire_timeout) throws IOError;
string body, string[] actions, HashTable<string, Variant> hints, int32 expire_timeout) throws DBusError, IOError;
}
public class MediaFeedback : GLib.Object
@ -121,7 +121,7 @@ namespace Gala
try {
notification_id = notifications.notify ("gala-feedback", notification_id, feedback.icon, "", "", {}, hints, 2000);
} catch (IOError e) {
} catch (Error e) {
critical ("%s", e.message);
}
}

View File

@ -20,7 +20,7 @@ namespace Gala
[DBus (name = "org.gnome.ScreenSaver")]
public interface ScreenSaver : GLib.Object
{
public abstract bool get_active () throws GLib.IOError;
public abstract bool get_active () throws DBusError, IOError;
public signal void active_changed (bool active);
}

View File

@ -38,12 +38,12 @@ namespace Gala
wm = _wm;
}
public void flash_area (int x, int y, int width, int height)
public void flash_area (int x, int y, int width, int height) throws DBusError, IOError
{
warning ("FlashArea not implemented");
}
public void screenshot (bool include_cursor, bool flash, string filename, out bool success, out string filename_used)
public void screenshot (bool include_cursor, bool flash, string filename, out bool success, out string filename_used) throws DBusError, IOError
{
debug ("Taking screenshot");
@ -54,7 +54,7 @@ namespace Gala
success = save_image (image, filename, out filename_used);
}
public async void screenshot_area (int x, int y, int width, int height, bool flash, string filename, out bool success, out string filename_used) throws DBusError
public async void screenshot_area (int x, int y, int width, int height, bool flash, string filename, out bool success, out string filename_used) throws DBusError, IOError
{
debug ("Taking area screenshot");
@ -66,7 +66,7 @@ namespace Gala
throw new DBusError.FAILED ("Failed to save image");
}
public void screenshot_window (bool include_frame, bool include_cursor, bool flash, string filename, out bool success, out string filename_used)
public void screenshot_window (bool include_frame, bool include_cursor, bool flash, string filename, out bool success, out string filename_used) throws DBusError, IOError
{
debug ("Taking window screenshot");
@ -91,7 +91,7 @@ namespace Gala
success = save_image (image, filename, out filename_used);
}
public async void select_area (out int x, out int y, out int width, out int height)
public async void select_area (out int x, out int y, out int width, out int height) throws DBusError, IOError
{
var selection_area = new SelectionArea (wm);
selection_area.closed.connect (() => Idle.add (select_area.callback));