Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ namespace Scratch {
public const string ACTION_FIND_GLOBAL = "action-find-global";
public const string ACTION_OPEN = "action-open";
public const string ACTION_OPEN_FOLDER = "action-open-folder";
public const string ACTION_OPEN_FOLDER_ACCEL = "<Shift><Control>o";
public const string ACTION_COLLAPSE_ALL_FOLDERS = "action-collapse-all-folders";
public const string ACTION_ORDER_FOLDERS = "action-order-folders";
public const string ACTION_GO_TO = "action-go-to";
Expand Down Expand Up @@ -207,8 +208,8 @@ namespace Scratch {
action_accelerators.set (ACTION_FIND_PREVIOUS, "<Control><shift>g");
action_accelerators.set (ACTION_FIND_GLOBAL + "::", "<Control><shift>f");
action_accelerators.set (ACTION_OPEN, "<Control>o");
action_accelerators.set (ACTION_OPEN_FOLDER, "<Control><Shift>o");
action_accelerators.set (ACTION_REVERT, "<Control><shift>o");
action_accelerators.set (ACTION_OPEN_FOLDER + "::", ACTION_OPEN_FOLDER_ACCEL);
action_accelerators.set (ACTION_REVERT, "<Control><shift>r");
action_accelerators.set (ACTION_SAVE, "<Control>s");
action_accelerators.set (ACTION_SAVE_AS, "<Control><shift>s");
action_accelerators.set (ACTION_GO_TO, "<Control>i");
Expand Down
1 change: 1 addition & 0 deletions src/Widgets/ChooseProjectButton.vala
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public class Code.ChooseProjectButton : Gtk.MenuButton {
action_name = Scratch.MainWindow.ACTION_PREFIX + Scratch.MainWindow.ACTION_OPEN_FOLDER,
action_target = new Variant.string (""),
icon_name = "folder-open-symbolic",
accel_string = Scratch.MainWindow.ACTION_OPEN_FOLDER_ACCEL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a workaround for a bug in accel label. We should probably fix the bug instead

};

var clone_button = new PopoverMenuItem (_("Clone Git Repository…")) {
Expand Down
25 changes: 16 additions & 9 deletions src/Widgets/PopoverMenuItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@ public class Code.PopoverMenuItem : Gtk.Button {
/**
* The icon name for the button
*/
public string icon_name { get; set; }
private Gtk.Image gtk_image;
public string icon_name {
set {
gtk_image.icon_name = value;
}
}
private Granite.AccelLabel accel_label;
public string accel_string {
set {
accel_label.accel_string = value;
}
}

public PopoverMenuItem (string text) {
Object (text: text);
Expand All @@ -23,13 +34,12 @@ public class Code.PopoverMenuItem : Gtk.Button {
}

construct {
var image = new Gtk.Image ();

var label = new Granite.AccelLabel (text);
gtk_image = new Gtk.Image ();
accel_label = new Granite.AccelLabel (text);

var box = new Gtk.Box (HORIZONTAL, 6);
box.add (image);
box.add (label);
box.add (gtk_image);
box.add (accel_label);

child = box;

Expand All @@ -41,8 +51,5 @@ public class Code.PopoverMenuItem : Gtk.Button {
popover.popdown ();
}
});

bind_property ("action-name", label, "action-name");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of removing this we should probably add an action_target property to accel label

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, but Code is still using the Gtk3 Granite library - is this still being developed?

bind_property ("icon-name", image, "icon-name");
}
}