Skip to content

Commit

Permalink
resolve add and delete taskbar icon dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
qk committed Jan 22, 2018
1 parent 610c062 commit f19d62e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions indicator-application/indicator-application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ IndicatorApplication::IndicatorApplication(AppletData *ad) :
orientation(ad->orientation),
icon_size(16)
{
char *path;
GSettings *settings;

tray = na_tray_new_for_screen(gtk_widget_get_screen(GTK_WIDGET(applet)), orientation);
force_no_focus_padding(GTK_WIDGET(tray));

Expand All @@ -50,6 +53,13 @@ IndicatorApplication::IndicatorApplication(AppletData *ad) :
G_CALLBACK(applet_size_changed), this);

applet_size_changed(applet, ukui_panel_applet_get_size(applet), this);

for(int i = 1; i < 20; i ++){
path = g_strdup_printf ("%s%d/", "/org/ukui/panel/indicator/tray", i);
settings = g_settings_new_with_path ("org.ukui.panel.indicator.tray", path);

g_settings_set_int (settings, "number",0);
}
}

IndicatorApplication::~IndicatorApplication()
Expand Down
11 changes: 11 additions & 0 deletions indicator-application/na-tray-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@ na_tray_manager_plug_removed (GtkSocket *socket,
return FALSE;
}

static void
tray_widget_destroy (GtkWidget *child,
GSettings *settings)
{
g_settings_set_int (settings,"number",-1);
}
static void
tray_widget_show_notify (GSettings *settings,
gchar *key,
Expand Down Expand Up @@ -341,6 +347,11 @@ na_tray_manager_handle_dock_request (NaTrayManager *manager,
G_CALLBACK (tray_widget_show_notify),
child);

g_signal_connect (child,
"destroy",
G_CALLBACK (tray_widget_destroy),
settings);

GdkDisplay *display;
display = gdk_screen_get_display (manager->screen);

Expand Down

0 comments on commit f19d62e

Please sign in to comment.