{
private const string LogTag = "Tizen.Applications.Shortcut";
- private static Interop.Shortcut.ResultCallback shortcutAddResult = null;
-
- private static Interop.Shortcut.ResultCallback widgetAddResult = null;
-
- private static Interop.Shortcut.ResultCallback shortcutDeleteResult = null;
-
/// <summary>
/// Adds a shortcut on the home-screen.
/// </summary>
type = 1;
}
- if (shortcutAddResult == null)
- {
- shortcutAddResult = new Interop.Shortcut.ResultCallback(ShortcutAddResultCallback);
- }
-
- err = Interop.Shortcut.AddToHome(shortcut.ShortcutName, type, shortcut.Uri, shortcut.IconPath, Convert.ToInt32(shortcut.IsAllowDuplicate), shortcutAddResult, IntPtr.Zero);
+ err = Interop.Shortcut.AddToHome(shortcut.ShortcutName, type, shortcut.Uri, shortcut.IconPath, Convert.ToInt32(shortcut.IsAllowDuplicate));
if (err != Interop.Shortcut.ErrorCode.None)
{
throw ShortcutErrorFactory.GetException(err, "unable to add shortcut");
try
{
- if (widgetAddResult == null)
- {
- widgetAddResult = new Interop.Shortcut.ResultCallback(WidgetAddResultCallback);
- }
-
- err = Interop.Shortcut.AddToWidget(shortcut.ShortcutName, shortcut.WidgetSize, shortcut.WidgetId, shortcut.IconPath, shortcut.Period, Convert.ToInt32(shortcut.IsAllowDuplicate), widgetAddResult, IntPtr.Zero);
+ err = Interop.Shortcut.AddToWidget(shortcut.ShortcutName, shortcut.WidgetSize, shortcut.WidgetId, shortcut.IconPath, shortcut.Period, Convert.ToInt32(shortcut.IsAllowDuplicate));
if (err != Interop.Shortcut.ErrorCode.None)
{
throw ShortcutErrorFactory.GetException(err, "unable to add widget");
try
{
- if (shortcutDeleteResult == null)
- {
- shortcutDeleteResult = new Interop.Shortcut.ResultCallback(DeleteResultCallback);
- }
-
- err = Interop.Shortcut.Delete(shortcutName, shortcutDeleteResult, IntPtr.Zero);
+ err = Interop.Shortcut.Delete(shortcutName);
if (err != Interop.Shortcut.ErrorCode.None)
{
throw ShortcutErrorFactory.GetException(err, "unable to delete shortcut");
throw ShortcutErrorFactory.GetException(Interop.Shortcut.ErrorCode.IoError, e.Message);
}
}
-
- private static int ShortcutAddResultCallback(int ret, IntPtr data)
- {
- if (ret != (int)Interop.Shortcut.ErrorCode.None)
- {
- Log.Error(LogTag, "unable to add shortcut " + ret);
- }
-
- return 0;
- }
-
- private static int WidgetAddResultCallback(int ret, IntPtr data)
- {
- if (ret != (int)Interop.Shortcut.ErrorCode.None)
- {
- Log.Error(LogTag, "unable to add widget " + ret);
- }
-
- return 0;
- }
-
- private static int DeleteResultCallback(int ret, IntPtr data)
- {
- if (ret != (int)Interop.Shortcut.ErrorCode.None)
- {
- Log.Error(LogTag, "unable to delete shortcut " + ret);
- }
-
- return 0;
- }
}
}
COMM = -0x01160000 | 0x40
}
- [DllImport(Libraries.Shortcut, EntryPoint = "shortcut_add_to_home")]
- internal static extern ErrorCode AddToHome(string name, int type, string uri, string icon, int dubplicate, ResultCallback result, IntPtr data);
+ [DllImport(Libraries.Shortcut, EntryPoint = "shortcut_add_to_home_sync")]
+ internal static extern ErrorCode AddToHome(string name, int type, string uri, string icon, int dubplicate);
- [DllImport(Libraries.Shortcut, EntryPoint = "shortcut_add_to_home_widget")]
- internal static extern ErrorCode AddToWidget(string name, ShortcutWidgetSize size, string widgetId, string icon, double period, int dubplicate, ResultCallback result, IntPtr data);
+ [DllImport(Libraries.Shortcut, EntryPoint = "shortcut_add_to_home_widget_sync")]
+ internal static extern ErrorCode AddToWidget(string name, ShortcutWidgetSize size, string widgetId, string icon, double period, int dubplicate);
- [DllImport(Libraries.Shortcut, EntryPoint = "shortcut_remove_from_home")]
- internal static extern ErrorCode Delete(string name, ResultCallback result, IntPtr data);
+ [DllImport(Libraries.Shortcut, EntryPoint = "shortcut_remove_from_home_sync")]
+ internal static extern ErrorCode Delete(string name);
[DllImport(Libraries.Shortcut, EntryPoint = "shortcut_get_list")]
internal static extern ErrorCode GetList(string name, ListCallback list, IntPtr data);